mercredi 3 mai 2017

Java Reflection get only methods of subclass (without equals, hashcode etc)

Is there a way to get the methods of an Class object, without getting the methods defined by the Object class?

Right now I am using getDeclaredMethods() to look for a specific method with a list of parameters.

My problem is that this also returns functions like "equals", "hashCode", etc... and thus it could be ambigious between these functions and the one im looking for.

Looking at the documentation, it says that it only returns the public methods defined by this class (or in my case an interface), and my objects never override these methods

is there any workaround for this?





Aucun commentaire:

Enregistrer un commentaire