Last active
December 24, 2015 04:19
-
-
Save darylteo/6743600 to your computer and use it in GitHub Desktop.
My Crazy Idea?
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
| public class Verticle { | |
| public static void main(String[] args) throws Exception { | |
| StackTraceElement[] stack = Thread.currentThread ().getStackTrace (); | |
| for(StackTraceElement e : stack) { | |
| System.out.println(e); | |
| } | |
| StackTraceElement main = stack[stack.length - 1]; | |
| String mainClass = main.getClassName (); | |
| System.out.println("I am a: " + mainClass); | |
| Vertx vertx = new Vertx(); | |
| Container container = new Container(); | |
| Verticle verticle = (Verticle) Class.forName(mainClass).newInstance(); | |
| verticle.setVertx(vertx); | |
| verticle.setContainer(container); | |
| verticle.start(); | |
| } | |
| public void setVertx(Vertx vertx) {} | |
| public void setContainer(Container container){} | |
| public void start() {} | |
| public void stop() {} | |
| } | |
| class MyVerticle extends Verticle { | |
| public static void main(String[] args) throws Exception { | |
| Verticle.main(args); | |
| } | |
| public void start() { | |
| System.out.println("My Verticle Started!"); | |
| } | |
| } | |
| // blah | |
| class Vertx { } | |
| class Container { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment