Top Description Methods
com.airhacks.afterburner.injection

public Interface PresenterFactory

Imports
java.util.List, .ServiceLoader, java.util.function.Function, java.util.stream.Collectors, .StreamSupport, org.slf4j.Logger, .LoggerFactory

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 Summary

Modifier and TypeMethod and Description
public static PresenterFactory

Returns:

the discovered implementations of PresenterFactory using the java.util.ServiceLoader mechanism
discover
()

public void
injectMembers(Object
the object to inject members into
instance
,
Function<String, Object>
a cache of already instantiated and initialized instances
injectionContext
)

Populate the given object.

public <
the type of the presenter
T
>
T

Returns:

a fully initialized presenter with injected dependencies.
instantiatePresenter
(Class<T>
presenter class containing the default constructor
clazz
,
Function<String, Object>
a cache of already instantiated and initialized instances
injectionContext
)

This method method replaces the standard afterburner dependency injection.

Method Detail

discoverback to summary
public static PresenterFactory discover()
Returns:PresenterFactory

the discovered implementations of PresenterFactory using the java.util.ServiceLoader mechanism

injectMembersback to summary
public void injectMembers(Object instance, Function<String, Object> injectionContext)

Populate the given object. For example, set all fields annotated with jakarta.inject.Inject.

Parameters
instance:Object

the object to inject members into

injectionContext:Function<String, Object>

a cache of already instantiated and initialized instances

instantiatePresenterback to summary
public <T> T instantiatePresenter(Class<T> clazz, Function<String, Object> injectionContext)

This method method replaces the standard afterburner dependency injection.

Parameters
<T>
the type of the presenter
clazz:Class<T>

presenter class containing the default constructor

injectionContext:Function<String, Object>

a cache of already instantiated and initialized instances

Returns:T

a fully initialized presenter with injected dependencies.