jeudi 6 décembre 2018

How to invoke the getter in the POJO through reflection API

There is one getter method say getAddressText1() on a pojo which is designed in the following way -:

public class AccountDetails{

public String name;
public Address address;
.
.
//getters and setters
}

now This addressText1 inside the Address

something like

public class Address{

public String addressText1;
.
.
//getters and setters
}

now if i will invoke the getAddressText1 on the AccountDetails its going to throw the methodnotfound exception.

Since this is the Reflection I dont have a control to apply on Address directly.

Please reply if you know the solution.

Thanks!!





Aucun commentaire:

Enregistrer un commentaire