Class CloneUtil


  • public class CloneUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CloneUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T cloneByCopyConstructor​(T value)
      Clones an object by locating and invoking its copy constructor.
      static <T extends java.io.Serializable>
      T
      cloneBySerialization​(T value)
      Clones an object through serialization.
      static <T> T cloneIfPossible​(T value)
      Clones a value if necessary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CloneUtil

        public CloneUtil()
    • Method Detail

      • cloneByCopyConstructor

        public static <T> T cloneByCopyConstructor​(T value)
        Clones an object by locating and invoking its copy constructor.
      • cloneIfPossible

        public static <T> T cloneIfPossible​(T value)
        Clones a value if necessary. If the value is a primitive, returns the original value. If it's an array, makes a deep copy.
      • cloneBySerialization

        public static <T extends java.io.Serializable> T cloneBySerialization​(T value)
        Clones an object through serialization. Warning: currently dangerous to use in Ignition due to the class resolving. Likely need to pass in a new ClassResolver interface and use ModuleObjectInputStream.