Package org.powermock.classloading
Class DeepCloner
- java.lang.Object
-
- org.powermock.classloading.DeepCloner
-
- All Implemented Interfaces:
DeepClonerSPI
public class DeepCloner extends Object implements DeepClonerSPI
The purpose of the deep cloner is to create a deep clone of an object. An object can also be cloned to a different class-loader.
-
-
Constructor Summary
Constructors Constructor Description DeepCloner()Clone using the current ContextClassLoader.DeepCloner(ClassLoader classLoader)Clone using the supplied ClassLoader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tclone(T objectToClone)Clones an object.<T> Tclone(T objectToClone, boolean includeStandardJavaType)
-
-
-
Constructor Detail
-
DeepCloner
public DeepCloner(ClassLoader classLoader)
Clone using the supplied ClassLoader.
-
DeepCloner
public DeepCloner()
Clone using the current ContextClassLoader.
-
-
Method Detail
-
clone
public <T> T clone(T objectToClone)
Clones an object.- Specified by:
clonein interfaceDeepClonerSPI- Returns:
- A deep clone of the object to clone.
-
clone
public <T> T clone(T objectToClone, boolean includeStandardJavaType)- Parameters:
includeStandardJavaType-truealso clones standard java types (using simple serialization),falsesimply reference to these objects (will be same instance).- Returns:
- A deep clone of the object to clone.
-
-