samedi 22 août 2015

java reflection: pass a value from the calling class but not as parameter

I have written a java class A with Method 'm' which I am loading dynamically in my program by reading A.class from the disk and using defineclass to recreate the class. Then I am invoking m in A.class from Main function of my program using m.invoke(instance of A). The Method does not take any parameters. Can I "somehow" read a variable defined in the Main function of my program from inside m once it has been invoked?





Aucun commentaire:

Enregistrer un commentaire