I have a simple Java POJO that I would copy properties to another instance of same POJO class.
I know I can do that with BeanUtils.copyProperties() but I would like
I ran into some problems with Introspector.getBeanInfo not returning all the properties, so I ended up implementing a field copy instead of property copy.
public static void copyFields(T target, T source) throws Exception{
Class> clazz = source.getClass();
for (Field field : clazz.getFields()) {
Object value = field.get(source);
field.set(target, value);
}
}