I have an anonymous class:
Object myArbitraryObject = new Object(){
};
Now I load a list of functions at runtime:
for(String methodName: methodNames){
Method arbitraryMethod = this.getClass().getMethod(methodName);
// TODO: add arbitraryMethod to arbitraryObject.
}
... and at a later stage:
Method [] allArbitMethods = myArbitraryObject.getClass.getMethods();
// invoking allMethods....
Is this possible? How / Why?
Aucun commentaire:
Enregistrer un commentaire