Skip to content

Instantly share code, notes, and snippets.

@k33g
Created February 24, 2011 09:37
Show Gist options
  • Save k33g/841973 to your computer and use it in GitHub Desktop.
Save k33g/841973 to your computer and use it in GitHub Desktop.
Class ObjectStructure
public class ObjectStructure {
public static Object getStructure(Object o, Object ro)
throws NoSuchFieldException,
IllegalArgumentException,
IllegalAccessException,
InstantiationException{
Field[] f = o.getClass().getFields();
for(int i=0;i<f.length;++i){
ro.getClass().getField(f[i].getName()).set(ro,f[i].get(o));
}
return ro;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment