public static <V, WRAP> List<WRAP> wrap(Class<WRAP> wrapper, Iterable<V> collection ) { List<WRAP> list = new ArrayList<>( ); for (V v : collection) { WRAP wrap = Reflection.newInstance ( wrapper, v ); list.add ( wrap ); } return list; }
public static <V, WRAP> List<WRAP> wrap(Class<WRAP> wrapper, V[] collection ) { List<WRAP> list = new ArrayList<>( collection.length ); for (V v : collection) { WRAP wrap = Reflection.newInstance ( wrapper, v ); list.add ( wrap ); } return list; }
public static <V, WRAP> List<WRAP> wrap(Class<WRAP> wrapper, Iterable<V> collection ) { List<WRAP> list = new ArrayList<>( ); for (V v : collection) { WRAP wrap = Reflection.newInstance ( wrapper, v ); list.add ( wrap ); } return list; }
public static <V, WRAP> List<WRAP> wrap(Class<WRAP> wrapper, V[] collection ) { List<WRAP> list = new ArrayList<>( collection.length ); for (V v : collection) { WRAP wrap = Reflection.newInstance ( wrapper, v ); list.add ( wrap ); } return list; }
public static Object newInstance( String className ) { try { Class<?> clazz = Class.forName( className ); return newInstance( clazz ); } catch ( Exception ex ) { log.info( String.format( "Unable to create this class %s", className ) ); return null; } }
public static Object newInstance( String className ) { try { Class<?> clazz = Class.forName( className ); return newInstance( clazz ); } catch ( Exception ex ) { log.info( String.format( "Unable to create this class %s", className ) ); return null; } }
public static <T> T createFromSrc( Object src, Class<T> dest ) { T instance = Reflection.newInstance(dest); fieldByFieldCopy( src, instance ); return instance; }
public static <T> T createFromSrc( Object src, Class<T> dest ) { T instance = Reflection.newInstance(dest); fieldByFieldCopy( src, instance ); return instance; }
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 ); } }
public static <T> T createFromArg(Class<T> clz, Object value) { if (value == null) { return Reflection.newInstance(clz);
public static <T> T createFromArg(Class<T> clz, Object value) { if (value == null) { return Reflection.newInstance(clz);
final Class<T> cls) { T newInstance = Reflection.newInstance( cls ); ValueMap map = ( ValueMap ) ( Map ) valueMap;
final Class<T> cls) { T newInstance = Reflection.newInstance( cls ); ValueMap map = ( ValueMap ) ( Map ) valueMap;
final Class<T> cls) { T newInstance = Reflection.newInstance( cls ); ValueMap map = ( ValueMap ) ( Map ) valueMap;
final Class<T> cls) { T newInstance = Reflection.newInstance( cls ); ValueMap map = ( ValueMap ) ( Map ) valueMap;
Map<String, FieldAccess> fields = Reflection.getAllAccessorFields( aClass ); T clone = Reflection.newInstance( aClass );
Map<String, FieldAccess> fields = Reflection.getAllAccessorFields( aClass ); T clone = Reflection.newInstance( aClass );
Object newInstance = Reflection.newInstance ( dstField.type() ); if (ignore == null) { fieldByFieldCopy( srcField.getObject( src ), newInstance );
Object newInstance = Reflection.newInstance ( dstField.type() ); if (ignore == null) { fieldByFieldCopy( srcField.getObject( src ), newInstance );