For example, we have a class:
public class Test {
private User user;
public User getUserProfile() {
return this.user;
}
public void setUserProfile(User user) {
this.user = user
}
}
The main criterion of accessor method in this case is return this.user;
for getter and this.user = argName;
for setter. As additional criteria we consider getter has return type of user
field and is no-arg method and setter has single argument of user
field type and has void
return type.
Is any way to define these methods?
I've tried Introspector.getBeanInfo(Class<?> c);
and apache BeanUtils.describe(Class<?> c);
and both of them use methods names to define corresponding field i.e. for Test
class they displaying field userProfile
.
Aucun commentaire:
Enregistrer un commentaire