Interface PresenterFactory

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface PresenterFactory
    The implementation of this interface is fully optional and only needed in case you would like to replaced the default Dependency Injection mechanism.

    Afterburner will discover the implementations of this interface using the Java extension mechanism.

    You will have to register the an implementation by placing a text file: META-INF/services/com.airhacks.afterburner.injection.PresenterFactory containing the fully qualified name of the implementation.

    Author:
    airhacks.com
    • Method Detail

      • instantiatePresenter

        <T> T instantiatePresenter​(java.lang.Class<T> clazz,
                                   java.util.function.Function<java.lang.String,​java.lang.Object> injectionContext)
        This method method replaces the standard afterburner dependency injection.
        Type Parameters:
        T - the type of the presenter
        Parameters:
        clazz - presenter class containing the default constructor.
        injectionContext - a cache of already instantiated and initialized instances.
        Returns:
        a fully initialized presenter with injected dependencies.
      • discover

        static java.lang.Iterable<PresenterFactory> discover()
        Returns:
        all discovered implementations of PresenterFactory using the ServiceLoader mechanism