Created
February 20, 2013 08:40
-
-
Save darylteo/4994015 to your computer and use it in GitHub Desktop.
Discussion on static accessors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // I don't believe this should be required | |
| public static MyObject hypotheticalFactoryMethod(Vertx vertx){ | |
| Vertx.container.getLogger().log("Created"); | |
| return new MyObject(); | |
| } | |
| // or even this | |
| public static MyObject hypotheticalFactoryMethod(Logger logger){ | |
| logger.log("Created"); | |
| return new MyObject(); | |
| } | |
| // I could do this, but defeats the purpose of using the platform | |
| public static MyObject hypotheticalFactoryMethod(){ | |
| Logger logger = new Logger(...delegate); | |
| logger.log("Created"); | |
| return new MyObject(); | |
| } | |
| // What I want | |
| public static MyObject hypotheticalFactoryMethod(){ | |
| Vertx.locate().container.getLogger().log("Created"); | |
| return new MyObject(); | |
| } | |
| // Or maybe | |
| public static MyObject hypotheticalFactoryMethod(){ | |
| Logger.instance().log("Created"); | |
| return new MyObject(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment