samedi 25 juin 2022

How to get the fields and under fields in an Object via reflection?

can we retrieve the value of the fields of a class as well as the value of the fields of the classes it contains ?

Example :

public class Person {
    private String lastName;
    private String firstName;
    private Address address;
}

public class Address {
    protected String street;
    private String city;
}

I want to retrieve these values :

lastName firstName street city





Aucun commentaire:

Enregistrer un commentaire