Class PrototypeFactory.PrototypeCloneFactory

  • All Implemented Interfaces:
    java.io.Serializable, Factory
    Enclosing class:
    PrototypeFactory

    static class PrototypeFactory.PrototypeCloneFactory
    extends java.lang.Object
    implements Factory, java.io.Serializable
    PrototypeCloneFactory creates objects by copying a prototype using the clone method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.Method iCloneMethod
      The method used to clone
      private java.lang.Object iPrototype
      The object to clone each time
      private static long serialVersionUID
      The serial version
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PrototypeCloneFactory​(java.lang.Object prototype, java.lang.reflect.Method method)
      Constructor to store prototype.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object create()
      Creates an object by calling the clone method.
      private void findCloneMethod()
      Find the Clone method for the class specified.
      private void readObject​(java.io.ObjectInputStream is)
      Overrides the default readObject implementation to prevent de-serialization (see COLLECTIONS-580).
      private void writeObject​(java.io.ObjectOutputStream os)
      Overrides the default writeObject implementation to prevent serialization (see COLLECTIONS-580).
      • Methods inherited from class java.lang.Object

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

      • serialVersionUID

        private static final long serialVersionUID
        The serial version
        See Also:
        Constant Field Values
      • iPrototype

        private final java.lang.Object iPrototype
        The object to clone each time
      • iCloneMethod

        private transient java.lang.reflect.Method iCloneMethod
        The method used to clone
    • Constructor Detail

      • PrototypeCloneFactory

        private PrototypeCloneFactory​(java.lang.Object prototype,
                                      java.lang.reflect.Method method)
        Constructor to store prototype.
    • Method Detail

      • findCloneMethod

        private void findCloneMethod()
        Find the Clone method for the class specified.
      • create

        public java.lang.Object create()
        Creates an object by calling the clone method.
        Specified by:
        create in interface Factory
        Returns:
        the new object
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream os)
                          throws java.io.IOException
        Overrides the default writeObject implementation to prevent serialization (see COLLECTIONS-580).
        Throws:
        java.io.IOException
      • readObject

        private void readObject​(java.io.ObjectInputStream is)
                         throws java.lang.ClassNotFoundException,
                                java.io.IOException
        Overrides the default readObject implementation to prevent de-serialization (see COLLECTIONS-580).
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException