Object deep copy with white list t.

@param <T>        the type parameter
@param from       the from
@param to         the to
@param copyFields the copy fields
@return the t
182725
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) {
        return (T) to.getClass().cast(objDeepCopy(from, to, copyFields));
    }
1199403
public static <T> T objectDeepCopyWithBlackList(Object from, Class<T> toClass, String... blockFields) {
        Object to = getNewInstance(toClass);
        return objectDeepCopyWithBlackList(from, to, blockFields);
    }
56843
public static void copyMemoryFieldByField(long srcAddress, Object dest) {

    Class clazz = dest.getClass();
    while (clazz != Object.class) {
      for (Field f : clazz.getDeclaredFields()) {
        if ((f.getModifiers() & Modifier.STATIC) == 0) {
          final Class type = f.getType();

          // TODO maybe support Wrapper classes
          Preconditions.checkArgument(type.isPrimitive(), "Only primitives are supported");

          final long offset = unsafe.objectFieldOffset(f);
          final long src = srcAddress + offset;

          if (type == int.class) {
            unsafe.putInt(dest, offset, unsafe.getInt(src));

          } else if (type == long.class) {
            unsafe.putLong(dest, offset, unsafe.getLong(src));

          } else {
            throw new IllegalArgumentException("Type not supported yet: " + type);
          }
        }
      }
      clazz = clazz.getSuperclass();
    }
  }
10967
@Override
	public T copy(T from) {
		if (CONCURRENT_ACCESS_CHECK) {
			enterExclusiveThread();
		}

		try {
			checkAvroInitialized();
			return avroData.deepCopy(runtimeSchema, from);
		}
		finally {
			if (CONCURRENT_ACCESS_CHECK) {
				exitExclusiveThread();
			}
		}
	}
1023599
public static void copyFile(String fromFilename, String toFilename) throws IOException {
        copyFile(new File(fromFilename), new File(toFilename));
    }
1303678
@SuppressWarnings("unchecked")
    public static <T> T convert(Object fromValue, Class<T> toType) throws TypeCastException {
        return convert(fromValue, toType, (String) null);
    }
12128
function(from, to, callback) {
  fse.copy(from, to, function (err) {
    if (err) {
      callback(err);
    } else {
      callback(null);
    }
  });
}
706492
private static void copy(Class<?> toType, Object to, Object... from) {
        int f = 0, fi = 0,
            length = Array.getLength(from[0]),
            total = from.length > 1 ? Array.getLength(to) : length;
        if ( Types.arrayDimensions(to.getClass()) == 1 ) {
            for ( int i = 0; i < total; i++ ) {
                Object value = Array.get(from[f], fi++);
                try {
                    value = Primitive.unwrap(
                            Types.castObject(value, toType, Types.CAST));
                } catch (UtilEvalError e) { /* ignore cast errors */ }
                if ( Byte.TYPE == toType )
                    Array.setByte(to, i, (byte) value);
                else if ( Short.TYPE == toType )
                    Array.setShort(to, i, (short) value);
                else if ( Integer.TYPE == toType )
                    Array.setInt(to, i, (int) value);
                else if ( Long.TYPE == toType )
                    Array.setLong(to, i, (long) value);
                else if ( Float.TYPE == toType )
                    Array.setFloat(to, i, (float) value);
                else if ( Double.TYPE == toType )
                    Array.setDouble(to, i, (double) value);
                else if ( Character.TYPE == toType )
                    Array.setChar(to, i, (char) value);
                else if ( Boolean.TYPE == toType )
                    Array.setBoolean(to, i, (boolean) value);
                else
                    Array.set(to, i, value);

                // concatenate multiple from arrays
                if ( length < total && fi == length && f+1 < from.length ) {
                    length = Array.getLength(from[++f]);
                    fi = 0;
                }
            }
        } else for ( int i = 0; i < total; i++ ) {
            // concatenate multiple from arrays
            if ( length < total && fi == length && f+1 < from.length ) {
                length = Array.getLength(from[++f]);
                fi = 0;
            }

            Object frm = Array.get(from[f], fi++);

            // null dimension example: new Integer[2][]
            if ( null == frm ) {
                Array.set(to, i, null);
                continue;
            }

            Object tto = Array.get(to, i);

            // mixed array lengths in multiple dimensions ex: {{1,2}, {3}}
            if ( Array.getLength(frm) != Array.getLength(tto) )
                Array.set(to, i,
                    tto = Array.newInstance(toType, dimensions(frm)));

            // recurse copy for next array dimension
            copy(toType, tto, frm);
        }
    }
1141743
public static <T> List<T> copyOf(Collection<T> source) {
        Preconditions.checkNotNull(source);
        if (source instanceof ImmutableList<?>) {
            return (ImmutableList<T>) source;
        }
        if (source.isEmpty()) {
            return Collections.emptyList();
        }
        return ofInternal(source.toArray());
    }
1325648
public <T, E extends T> void copyPropertiesOfInheritedClass(final T src, final E dest) {
        if (src == null) {
            throw new IllegalArgumentException("src can't be null");
        }
        if (dest == null) {
            throw new IllegalArgumentException("dest can't be null");
        }
        final Class<? extends Object> srcClz = src.getClass();
        final Class<? extends Object> destClz = dest.getClass();
        if (srcClz.isArray()) {
            if (!destClz.isArray()) {
                throw new IllegalArgumentException("can't copy from array to non-array class " + destClz);
            }
            final int length = Array.getLength(src);
            for (int i = 0; i < length; i++) {
                final Object v = Array.get(src, i);
                Array.set(dest, i, v);
            }
            return;
        }
        final List<Field> fields = allFields(srcClz);
        for (final Field field : fields) {
            if (!Modifier.isStatic(field.getModifiers())) {
                try {
                    final Object fieldObject = field.get(src);
                    field.set(dest, fieldObject);
                } catch (final IllegalArgumentException e) {
                    throw new RuntimeException(e);
                } catch (final IllegalAccessException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
120304
public function copyValuesFromInterface(OrderAddressInterface $from, OrderAddressInterface $to)
    {
        // account
        $to->setAccountName($from->getAccountName());
        $to->setUid($from->getUid());
        // contact
        $to->setTitle($from->getTitle());
        $to->setSalutation($from->getSalutation());
        $to->setFirstName($from->getFirstName());
        $to->setLastName($from->getLastName());
        $to->setEmail($from->getEmail());
        $to->setPhone($from->getPhone());
        $to->setPhoneMobile($from->getPhoneMobile());
        // address
        $to->setStreet($from->getStreet());
        $to->setNumber($from->getNumber());
        $to->setAddition($from->getAddition());
        $to->setZip($from->getZip());
        $to->setCity($from->getCity());
        $to->setState($from->getState());
        $to->setCountry($from->getCountry());
        $to->setContactAddress($from->getContactAddress());
        $to->setNote($from->getNote());
        // postbox
        $to->setPostboxCity($from->getPostboxCity());
        $to->setPostboxNumber($from->getPostboxNumber());
        $to->setPostboxPostcode($from->getPostboxPostcode());
    }
435597
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static final <TO, FROM> TO convert(Class<TO> to, FROM from) {

		// Convert null value
		if (from == null || to == null) {
			return null;
		}

		// Convert "null" String to null
		if ("null".equals(from)) {
			return null;
		}

		// Class is same
		if (to == Object.class || from.getClass() == to) {
			return (TO) from;
		}

		// BSON conversion
		boolean isFromMap = from != null && from instanceof Map;
		if (isFromMap) {
			Object subValue = getSubValue((Map) from);
			if (subValue != null) {
				return convert(to, subValue);
			}
		}

		// Convert FROM -> TO
		DataConverterKey<TO, FROM> key = new DataConverterKey<TO, FROM>(to, (Class<FROM>) from.getClass());
		DataConverter<TO, FROM> converter = (DataConverter<TO, FROM>) converters.get(key);
		if (converter != null) {
			return converter.convert(from);
		}

		// Convert any -> TO
		converter = (DataConverter<TO, FROM>) defaultConverters.get(to);
		if (converter != null) {
			return converter.convert(from);
		}

		// Converter not found
		throw new IllegalArgumentException("Unable to convert " + from.getClass() + " to " + to
				+ ", converter not found in DataConverterRegistry!");
	}
830368
public final void copyPrimitiveField(Object source, Object copy, Field field) {
		copyPrimitiveAtOffset(source, copy, field.getType(), getObjectFieldOffset(field));
	}
1369807
public static void copyFetches(Fetch<?, ?> from, Fetch<?, ?> to) {
        for (Fetch<?, ?> f : from.getFetches()) {
            Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName());
            // recursively copy fetches
            copyFetches(f, toFetch);
        }
    }
726833
@Inline(value="$2.$3copyOf($1)", imported=ImmutableList.class)
	public static <T> List<T> immutableCopy(List<? extends T> list) {
		return ImmutableList.copyOf(list);
	}
738128
public static void copy(Message from, HttpMessage to) {
        HttpMessage source;
        if (from instanceof HttpMessage) {
            source = (HttpMessage) from;
        } else {
            source = new HttpMessage(from);
        }

        copy(source, to);
    }
998549
public static function copy($names, $from, &$to)
    {
        if (is_array($from) && is_array($to)) {
            foreach ($names as $key) {
                if (isset($from[$key]) && !isset($to[$key])) {
                    $to[$key] = static::getValue($from, $key);
                }
            }
        }
        return $to;
    }