Class CollectionCloner

java.lang.Object
com.comphenix.protocol.reflect.cloning.CollectionCloner
All Implemented Interfaces:
Cloner

public class CollectionCloner extends Object implements Cloner
Attempts to clone collection and array classes.
  • Constructor Details

    • CollectionCloner

      public CollectionCloner(Cloner defaultCloner)
      Constructs a new collection and array cloner with the given inner element cloner.
      Parameters:
      defaultCloner - - default inner element cloner.
  • Method Details

    • canClone

      public boolean canClone(Object source)
      Description copied from interface: Cloner
      Determine whether the current cloner can clone the given object.
      Specified by:
      canClone in interface Cloner
      Parameters:
      source - - the object that is being considered.
      Returns:
      TRUE if this cloner can actually clone the given object, FALSE otherwise.
    • clone

      public Object clone(Object source)
      Description copied from interface: Cloner
      Perform the clone.

      This method should never be called unless a corresponding Cloner.canClone(Object) returns TRUE.

      Specified by:
      clone in interface Cloner
      Parameters:
      source - - the value to clone.
      Returns:
      A cloned value.
    • getDefaultCloner

      public Cloner getDefaultCloner()
      Retrieve the default cloner used to clone the content of each element in the collection.
      Returns:
      Cloner used to clone elements.