Class CloneHelper


  • public class CloneHelper
    extends java.lang.Object
    Helps to deep clone complex objects The following classes and their subclasses does have a fastpath - com.yahoo.component.provider.FreezableClass - com.yahoo.processing.request.properties.PublicCloneable BTW, this is the one you should implement too if you want the fastpath. - java.util.LinkedList - java.util.ArrayList The rest has the slow path with reflection, though using a fast thread safe method cache for speedup.
    Author:
    bratseth, baldersheim
    • Constructor Summary

      Constructors 
      Constructor Description
      CloneHelper()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone​(java.lang.Object object)
      Clones this object if it is clonable, and the clone is public.
      java.util.Map<CompoundName,​java.lang.Object> cloneMap​(java.util.Map<CompoundName,​java.lang.Object> map)
      Clones a map by deep cloning each value which is cloneable and shallow copying all other values.
      protected java.lang.Object objectClone​(java.lang.Object object)  
      • Methods inherited from class java.lang.Object

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

      • CloneHelper

        public CloneHelper()
    • Method Detail

      • clone

        public final java.lang.Object clone​(java.lang.Object object)
        Clones this object if it is clonable, and the clone is public. Returns null if not
      • objectClone

        protected java.lang.Object objectClone​(java.lang.Object object)
      • cloneMap

        public java.util.Map<CompoundName,​java.lang.Object> cloneMap​(java.util.Map<CompoundName,​java.lang.Object> map)
        Clones a map by deep cloning each value which is cloneable and shallow copying all other values.