I want to have a depper look into java reflection and hibernate. To pass values to a known setter works, but I want to do the same with an unknown setter of a hibernate pojo. I get the mapped class with
PersistentClass mappedClass = session.configuration.getClassMapping(classFromPath.getName());
Table myTable = mappedClass.getTable();
iter = myTable.getColumnIterator();
while(iter.hasNext()) {
Column myColumn = (Column) iter.next();
Property myProperty = mappedClass.getProperty(myColumn.getName());
System.out.println(myProperty.getName());
}
This is my way, to get a specific property. Now, I want to get the propertys getter and setter methods. One way is to get the name, to concate the words get/set with the property names. I don't like that way and want a better solution. I know, there is a function like myProperty.getSetter, but I'm not sure, how to deal with it.
I'm totally wrong? Are there any ways to get the getter/setter methods?
Aucun commentaire:
Enregistrer un commentaire