public static void copyProperties( Object src, Object dest ) { fieldByFieldCopy( src, dest ); }
public static void copyProperties( Object src, Object dest, Set<String> ignore) { fieldByFieldCopy( src, dest, ignore ); }
public static void copyProperties( Object src, Object dest ) { fieldByFieldCopy( src, dest ); }
public static void copyProperties( Object src, Object dest, Set<String> ignore) { fieldByFieldCopy( src, dest, ignore ); }
public static <T> T createFromSrc( Object src, Class<T> dest ) { T instance = Reflection.newInstance(dest); fieldByFieldCopy( src, instance ); return instance; }
public static void copyProperties( Object src, Object dest, String... ignore) { fieldByFieldCopy( src, dest, Sets.set(ignore) ); }
public static <T> T createFromSrc( Object src, Class<T> dest ) { T instance = Reflection.newInstance(dest); fieldByFieldCopy( src, instance ); return instance; }
public static void copyProperties( Object src, Object dest, String... ignore) { fieldByFieldCopy( src, dest, Sets.set(ignore) ); }
@SuppressWarnings("all") public static <T> T copy( T item ) { if ( item instanceof Cloneable ) { return (T) ClassMeta.classMeta(item.getClass()).invokeUntyped(item, "clone", ( Class[] ) null); } else { return fieldByFieldCopy( item ); } }
@SuppressWarnings("all") public static <T> T copy( T item ) { if ( item instanceof Cloneable ) { return (T) ClassMeta.classMeta(item.getClass()).invokeUntyped(item, "clone", ( Class[] ) null); } else { return fieldByFieldCopy( item ); } }
private static void handleCollectionFieldCopy( Object dst, FieldAccess dstField, Collection srcValue ) { if ( dstField.getComponentClass () != Typ.string ) { Collection dstCollection = Conversions.createCollection( dstField.type(), srcValue.size() ); for ( Object srcComponentValue : srcValue ) { Object newInstance = Reflection.newInstance( dstField.getComponentClass() ); fieldByFieldCopy( srcComponentValue, newInstance ); dstCollection.add ( newInstance ); } dstField.setObject ( dst, dstCollection ); } else { Collection dstCollection = Conversions.createCollection( dstField.type(), srcValue.size() ); for ( Object srcComponentValue : srcValue ) { if (srcComponentValue!=null) { dstCollection.add ( srcComponentValue.toString () ); } } dstField.setObject ( dst, dstCollection ); } }
private static void handleCollectionFieldCopy( Object dst, FieldAccess dstField, Collection srcValue ) { if ( dstField.getComponentClass () != Typ.string ) { Collection dstCollection = Conversions.createCollection( dstField.type(), srcValue.size() ); for ( Object srcComponentValue : srcValue ) { Object newInstance = Reflection.newInstance( dstField.getComponentClass() ); fieldByFieldCopy( srcComponentValue, newInstance ); dstCollection.add ( newInstance ); } dstField.setObject ( dst, dstCollection ); } else { Collection dstCollection = Conversions.createCollection( dstField.type(), srcValue.size() ); for ( Object srcComponentValue : srcValue ) { if (srcComponentValue!=null) { dstCollection.add ( srcComponentValue.toString () ); } } dstField.setObject ( dst, dstCollection ); } }
Object newInstance = Reflection.newInstance ( dstField.type() ); if (ignore == null) { fieldByFieldCopy( srcField.getObject( src ), newInstance ); } else { fieldByFieldCopy( srcField.getObject( src ), newInstance, ignore );
Object newInstance = Reflection.newInstance ( dstField.type() ); if (ignore == null) { fieldByFieldCopy( srcField.getObject( src ), newInstance ); } else { fieldByFieldCopy( srcField.getObject( src ), newInstance, ignore );