Class IdentityCloneFunction<T>

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

public class IdentityCloneFunction<T> extends Object implements CloneFunction<T>
A CloneFunction implementation that simply returns the passed object without cloning it. This is useful for forcing some object types (like Meshes) to be shared between the original and cloned object graph.
  • Constructor Details

    • IdentityCloneFunction

      public IdentityCloneFunction()
  • Method Details

    • cloneObject

      public T cloneObject(Cloner cloner, T object)
      Returns the object directly.
      Specified by:
      cloneObject in interface CloneFunction<T>
      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)
      Does nothing.
      Specified by:
      cloneFields in interface CloneFunction<T>
      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.