I was wondering if it is possible in Java to have something like the following:
public class MyClass { private String name; private Integer age; private Date dateOfBirth;
I am really stuck in the setField method and any idea would be very helpful.
Thanks!
EDIT: the reason for this is because I would like to have a method in another class, like the following
public static MyClass setAll(List<String> fieldNames, List<Object> fieldValues) { MyClass anObject = new MyClass();
java reflection
gpol
source share