Can I access to instance fields by the following syntax: student.address.city
public class Student {
private Address address;
//getters&setters
}
public class Address {
private String town;
private String street;
private String city;
//getters&setters
}
I think it can be done somehow using reflection. Basically I need something like:
String city = getPropertyValue("student.address.city", student);
Like in js we can access object properties.
Aucun commentaire:
Enregistrer un commentaire