Interface Cloner

All Known Implementing Classes:
AggregateCloner, BukkitCloner, CollectionCloner, FieldCloner, GuavaOptionalCloner, ImmutableDetector, JavaOptionalCloner, NullableCloner, SerializableCloner

public interface Cloner
Represents an object that is capable of cloning other objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canClone(Object source)
    Determine whether the current cloner can clone the given object.
    clone(Object source)
    Perform the clone.
  • Method Details

    • canClone

      boolean canClone(Object source)
      Determine whether the current cloner can clone the given object.
      Parameters:
      source - - the object that is being considered.
      Returns:
      TRUE if this cloner can actually clone the given object, FALSE otherwise.
    • clone

      Object clone(Object source)
      Perform the clone.

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

      Parameters:
      source - - the value to clone.
      Returns:
      A cloned value.
      Throws:
      IllegalArgumentException - If this cloner cannot perform the clone.