Class MethodObjectFactory<T>

  • Type Parameters:
    T - the type of the instances produced
    All Implemented Interfaces:
    Constructable<T>

    public class MethodObjectFactory<T>
    extends java.lang.Object
    implements Constructable<T>
    A Constructable using a method call to obtain an instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodObjectFactory​(java.lang.reflect.Method method)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T create​(java.util.List<Injection> injections)
      Creates an instance.
      void destroy​(T instance)
      Destroys an instance.
      • Methods inherited from class java.lang.Object

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

      • MethodObjectFactory

        public MethodObjectFactory​(java.lang.reflect.Method method)
        Constructs a new instance.
        Parameters:
        method - a Method, cannot be null
    • Method Detail

      • create

        public T create​(java.util.List<Injection> injections)
                 throws CreationException
        Description copied from interface: Constructable
        Creates an instance.
        Specified by:
        create in interface Constructable<T>
        Parameters:
        injections - a list of Injection containing values to be injected, never null or contains nulls but can be empty
        Returns:
        an instance, or null if it could not be provided
        Throws:
        CreationException - when instantiation fails
      • destroy

        public void destroy​(T instance)
        Description copied from interface: Constructable
        Destroys an instance.
        Specified by:
        destroy in interface Constructable<T>
        Parameters:
        instance - an instance to destroy, cannot be null