Class FieldObjectFactory<T>

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

    public class FieldObjectFactory<T>
    extends java.lang.Object
    implements Constructable<T>
    A Constructable which reads a field to obtain an instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldObjectFactory​(java.lang.reflect.Field field)
      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

      • FieldObjectFactory

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

      • create

        public T create​(java.util.List<Injection> injections)
        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
      • 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