I'm trying to use reflection to know fields and relative values of a Class (MyClass).
So far I did this, but this allow me to know just the fields of a "standard" Class, not a class filled with values by me:
MyClass filledMyclass = // I put here an object got from the DB with Hibernate.
I want to get the values got from the DB ///////////////
Class <?> class = MyClass.class;
Field [] fields = class.getClass().getDeclaredFields();
for(Field singleField: fields ){
System.out.println(singleField.getName());
}
How can I get the values of the object filledMyclass, that is filled by making a query?
I tried some code (that I didn't post here), but I didn't get what I wanted.
Aucun commentaire:
Enregistrer un commentaire