Hi,
I espone two question:
- why Class.forName has been deprecated?
Class cls = Class.forName(classname);
- and why getConstructor has been removed?
AppController controller = (AppController) cls.getConstructor(RoutingContext.class, Logger.class).newInstance(context, logger);
How I can to instance a class dinamically?
thanks
Dario
MyCommonInterface i = (MyCommonInterface)MyClass.class.newInstance();
MyNative my = NativeLookup.create(MyNative.class);
if(my != null && my.isSupported()) {
Log.p(my.helloWorld("Hi"));
}
Notice that "MyNative" is an interface not the implementation class and the build server injects the glue code to
the native code. Once it has that glue code in place it just does a put(class,impl) into the native lookup map
which we can then query for the real implementation.