Class ListCloneFunction<T extends List>

java.lang.Object
com.jme3.util.clone.ListCloneFunction<T>
All Implemented Interfaces:
CloneFunction<T>

public class ListCloneFunction<T extends List> extends Object implements CloneFunction<T>
A CloneFunction implementation that deep clones a list by creating a new list and cloning its values using the cloner.
  • Constructor Details

    • ListCloneFunction

      public ListCloneFunction()
  • Method Details

    • cloneObject

      public T cloneObject(Cloner cloner, T object)
      Description copied from interface: CloneFunction
      Performs a shallow clone of the specified object. This is similar to the JmeCloneable.clone() method in semantics and is the first part of a two part cloning process. Once the shallow clone is created, it is cached and CloneFunction.cloneFields() is called. In this way, the CloneFunction interface can completely take over the JmeCloneable style cloning for an object that doesn't otherwise implement that interface.
      Specified by:
      cloneObject in interface CloneFunction<T extends List>
      Parameters:
      cloner - The cloner performing the cloning operation.
      object - The original object that needs to be cloned.
      Returns:
      a new instance
    • cloneFields

      public void cloneFields(Cloner cloner, T clone, T object)
      Clones the elements of the list.
      Specified by:
      cloneFields in interface CloneFunction<T extends List>
      Parameters:
      cloner - The cloner performing the cloning operation.
      clone - The clone previously returned from cloneObject().
      object - The original object that was cloned. This is provided for the very special case where field cloning needs to refer to the original object. Mostly the necessary fields should already be on the clone.