Interface Constructable<T>

  • Type Parameters:
    T - the type of the instances produced
    All Known Subinterfaces:
    Injectable<T>
    All Known Implementing Classes:
    ClassObjectFactory, FieldObjectFactory, MethodObjectFactory

    public interface Constructable<T>
    Provides an object, potentially constructing it directly or indirectly and any other objects that it depends on.
    • Method Detail

      • create

        T create​(java.util.List<Injection> injections)
          throws CreationException
        Creates an instance.
        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

        void destroy​(T instance)
        Destroys an instance.
        Parameters:
        instance - an instance to destroy, cannot be null
      • needsDestroy

        boolean needsDestroy()
        Checks whether this constructable needs to be destroyed. A constructable does not need to be tracked if it doesn't need specific actions when it is about to be destroyed.
        Returns:
        true if the constructable needs to be destroyed, otherwise false