samedi 26 décembre 2020

Java getMethods() with respect to inheritance hirarchy

What I eventually want to do is to invoke all methods that have some annotation in a way such that:

  1. Overridden methods will be invoked only once.

  2. In case the class of the object is B, and it inherits from A which inherits from Object, I want the methods defined in Object with that annotation to be invoked first, then the methods in A, and then the methods in B.

Is there a way to get the methods sorted in such way?





Aucun commentaire:

Enregistrer un commentaire