vendredi 3 juin 2016

get DeclaredMethods of complex objects

I want to get all the declared methods of a complex object. I have following classes

class Person {
    public String getName();
    public String getDesignation();
    public Address getAddress();
}

Class Address {
    public String city;
    public String country;
}

Now when is use reflection

Person.class.getDeclaredMethod() 

given all the decalred methods

getName, getDesignation, getAddress

Person.class.getMethods()

given all the methods in declared methods or the methods of super class

getName, getDesignation, getAddress, toString, waitFor

How can i get the methods of child classes as weel when calling Person.class.getMethods()





Aucun commentaire:

Enregistrer un commentaire