Schnittstelle PresenterFactory


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.

  • Methodendetails

    • discover

      static PresenterFactory discover()
      Gibt zurück:
      the discovered implementations of PresenterFactory using the ServiceLoader mechanism
    • instantiatePresenter

      <T> T instantiatePresenter(Class<T> clazz, Function<String,Object> injectionContext)
      This method method replaces the standard afterburner dependency injection.
      Typparameter:
      T - the type of the presenter
      Parameter:
      clazz - presenter class containing the default constructor
      injectionContext - a cache of already instantiated and initialized instances
      Gibt zurück:
      a fully initialized presenter with injected dependencies.
    • injectMembers

      void injectMembers(Object instance, Function<String,Object> injectionContext)
      Populate the given object. For example, set all fields annotated with Inject.
      Parameter:
      instance - the object to inject members into
      injectionContext - a cache of already instantiated and initialized instances