Is there any way to obtain entity field tree? For example, I have
Class A {
private int id;
private String name;
private B objB;
}
class B {
private int id;
private String name;
private C objC;
}
class C {
private int id;
privaate String str;
}
So after I run the method, I can have a tree with the field name and type and how deep it is, which looks like below
A
|_________
| | |
id name B
|___________
| | |
id name C
|____
| |
id str
The idea coming to my mind is reflection, but want to get some guidance/clue on how to do it. Or if there is any other ideas? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire