Am developing an interpreter in Java and for easy extensibility, I am using some reflection at startup time so functions can be called just by their name.
So far I had the following structure of classes:
A extends B
B extends C
C extends D
And to access ALL the methods defined in any of those classes I used:
Method method = A.class.getMethod("theExpectedFunctionName");
That works.
However now that the project grew it turned out that it would be much more comfortable to have a class structure like:
B extends A
C extends A
D extends A
But now the getMethod function naturally doesn't work like that anymore. Is there a way how I can retrieve all methods that are in children classes of A?
Huge thanks in advance!
Aucun commentaire:
Enregistrer un commentaire