I have used java reflections to some extent but I am stuck in the case where I want the fields name of all classes that are directly and indirectly linked in. I know I am not completely clearing what I wanted to say so with out wasting any time lets consider following example,
Class Student {
String Name;
int RollNum;
List<Subjects> SubjectList;
UserModel mUserModel;
}
Class Subjects{
String Computer;
String Math;
String BIO;
List<Teacher> TeacherList;
}
Class UserModel {
String Address;
String Phone;
}
Class Teacher{
String Name;
String Specialization ;
}
so this the little example, now lets say I have the I am starting with the Student Class , Now I have following questions with using reflections.
1)How Can I get all the fields involved in this structure using the reflections. 2)How can i create the object of field if that field of a class is a type of my custom class , keep in mind here I do not want to do hard coding to know if the field is a instance of my custom classes.
Is there a way to get this what I want to do. Please help.
Aucun commentaire:
Enregistrer un commentaire