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.

  • Field Details

    • xStream

      private final com.thoughtworks.xstream.XStream xStream
  • Constructor Details

    • DeepCloner

      public DeepCloner(ClassLoader classLoader)
      Clone using the supplied ClassLoader.
      Parameters:
      classLoader - - the classloader to loaded cloned classes.
    • DeepCloner

      public DeepCloner()
      Clone using the current ContextClassLoader.
  • Method Details

    • disableSecurity

      private void disableSecurity()
    • clone

      public <T> T clone(T objectToClone)
      Clones an object.
      Specified by:
      clone in interface DeepClonerSPI
      Parameters:
      objectToClone - the object to clone.
      Returns:
      A deep clone of the object to clone.