/** * shallow clones "o". This means that if c=shallowClone(o) then * c!=o. Any change to c won't affect o. * * @param <T> the type of o * @param o the object to be shallow-cloned * @return a shallow clone of "o" */ public <T> T shallowClone(final T o) { if (o == null) return null; if (!cloningEnabled) return o; try { return cloneInternal(o, null); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }
/** * shallow clones "o". This means that if c=shallowClone(o) then * c!=o. Any change to c won't affect o. * * @param <T> the type of o * @param o the object to be shallow-cloned * @return a shallow clone of "o" */ public <T> T shallowClone(final T o) { if (o == null) return null; if (!cloningEnabled) return o; try { return cloneInternal(o, null); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }
public <T> T deepCloneDontCloneInstances(final T o, final Object... dontCloneThese) { if (o == null) return null; if (!cloningEnabled) return o; if (dumpCloned != null) { dumpCloned.startCloning(o.getClass()); } final Map<Object, Object> clones = new IdentityHashMap<Object, Object>(16); for (final Object dc : dontCloneThese) { clones.put(dc, dc); } try { return cloneInternal(o, clones); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }
public <T> T deepCloneDontCloneInstances(final T o, final Object... dontCloneThese) { if (o == null) return null; if (!cloningEnabled) return o; if (dumpCloned != null) { dumpCloned.startCloning(o.getClass()); } final Map<Object, Object> clones = new IdentityHashMap<Object, Object>(16); for (final Object dc : dontCloneThese) { clones.put(dc, dc); } try { return cloneInternal(o, clones); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }
/** * deep clones "o". * * @param <T> the type of "o" * @param o the object to be deep-cloned * @return a deep-clone of "o". */ public <T> T deepClone(final T o) { if (o == null) return null; if (!cloningEnabled) return o; if (dumpCloned != null) { dumpCloned.startCloning(o.getClass()); } final Map<Object, Object> clones = new IdentityHashMap<Object, Object>(16); try { return cloneInternal(o, clones); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }
/** * deep clones "o". * * @param <T> the type of "o" * @param o the object to be deep-cloned * @return a deep-clone of "o". */ public <T> T deepClone(final T o) { if (o == null) return null; if (!cloningEnabled) return o; if (dumpCloned != null) { dumpCloned.startCloning(o.getClass()); } final Map<Object, Object> clones = new IdentityHashMap<Object, Object>(16); try { return cloneInternal(o, clones); } catch (final IllegalAccessException e) { throw new CloningException("error during cloning of " + o, e); } }