Class PrototypeFactory.PrototypeCloneFactory<T>

  • All Implemented Interfaces:
    Factory<T>
    Enclosing class:
    PrototypeFactory

    static class PrototypeFactory.PrototypeCloneFactory<T>
    extends java.lang.Object
    implements Factory<T>
    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 T iPrototype
      The object to clone each time
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T create()
      Creates an object by calling the clone method.
      private void findCloneMethod()
      Find the Clone method for the class specified.
      • Methods inherited from class java.lang.Object

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

      • iPrototype

        private final T 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​(T 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 T create()
        Creates an object by calling the clone method.
        Specified by:
        create in interface Factory<T>
        Returns:
        the new object