|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.clone.CloneUtils
public class CloneUtils
Collection of utility methods to simplify cloning.
| Constructor Summary | |
|---|---|
CloneUtils()
|
|
| Method Summary | |
|---|---|
static Object |
cloneAsDeepAsPossible(Object o)
Clone the provided object if supported. |
static Object |
cloneAsDeepAsPossible(Object o,
int maxDepth)
Clone the provided object if supported. |
static void |
cloneMapEntries(Map<String,Object> source,
Map<String,Object> target)
Duplicate all entries of the source map to the target map and create clones of all contained objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CloneUtils()
| Method Detail |
|---|
public static void cloneMapEntries(Map<String,Object> source,
Map<String,Object> target)
throws DeepCloneException
source - the source for the key value pairs.target - the map to insert the created clones into.
DeepCloneException
public static Object cloneAsDeepAsPossible(Object o)
throws DeepCloneException
cloneAsDeepAsPossible(Object, int).
o - the object to be cloned.
DeepCloneException - if the depth of the cloned struture is too high or the
underlying clone methods failed.
public static Object cloneAsDeepAsPossible(Object o,
int maxDepth)
throws DeepCloneException
IDeepCloneables the IDeepCloneable.deepClone()
method is used, ignoring the maximal depth.Maps the contents (keys and values) are cloned and put
into a HashMap. The order is not preserved.Collections are cloned as an ArrayListCloneable, and has a public clone method, the
Object.clone() method is used.
o - the object to be cloned.maxDepth - the maximal depth of the structure before an exception is
thrown. A depth of 0 indicates that no recursive calls are
allowed, depth 1 allows 1 recursive call, and so on.
DeepCloneException - if the depth of the cloned struture is too high or the
underlying clone methods failed.
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||