Firstly, great library! I've been using it for a while now and it helps greatly with what I use it for.
On topic, I often deal with classes that are not the purest POJOs one would have seen, but very much require mock objects to be generated like a pure POJO would have. For instance, consider this class:
public class SpecialPojo {
private static class Holder {
private String holdingString;
private long holdingLong;
}
private Holder myHolder;
public SpecialPojo() {
myHolder = new Holder();
}
public String getMyString() {
return myHolder.holdingString;
}
public void setMyString(String myString) {
myHolder.holdingString = myString;
}
public long getMyLong() {
return myHolder.holdingLong;
}
public void setMyLong(long myLong) {
myHolder.holdingLong = myLong;
}
}
There's no reason to not call it a POJO, but PODAM won't map it b/c it's not got explicit state variables defined to match the setters/getters. If only PODAM didn't care about the instance variables and just tried to call the setters with the value to set, I'd have had an easier time mocking this class and generating an object with arbitrary values. Here's that part of PODAM (particularly the items in bold) I'm talking about:
public static ClassInfo getClassInfo(Class<?> clazz, Set<Class<? extends Annotation>> excludeFieldAnnotations) {
Set<String> classFields = getDeclaredInstanceFields(clazz, excludeFieldAnnotations);
Set<Method> classSetters = getPojoSetters(clazz, classFields);
return new ClassInfo(clazz, classFields, classSetters);
}
Is this something the PODAM team can look into? Don't you think it'd add value to relax PODAM's definition of POJO a bit to accommodate such special cases?