public interface Injector
| Modifier and Type | Method and Description |
|---|---|
static Injector |
create(java.lang.Iterable<? extends Module> modules) |
static Injector |
create(Module... modules) |
default <T> T |
getInstance(java.lang.Class<T> type)
Converts the specified class to a
TypeReference
and calls the overloaded method getInstance(TypeReference) |
<T> T |
getInstance(TypeReference<T> type)
Lowest-level method of
Injector for instantiating
and injecting a class. |
default <T> Provider<? extends T> |
getProvider(java.lang.Class<T> key)
Returns the explicit bound provider for the specified key
|
<T> Provider<? extends T> |
getProvider(TypeReference<T> key)
Returns the explicit bound provider for the specified key
|
default void |
injectMembers(java.lang.Object object) |
<T> void |
injectMembers(TypeReference<T> type,
T instance)
Lowest Level function of
Injector, resolves the specified type
and to injects fields and methods in
the specified instance, if the instance is null, the injector handles
it like a static injection |
void |
injectStaticMembers(java.lang.Class<?> clazz)
Injects the static members of the specified class,
equivalent to execute the overloaded method
injectMembers(TypeReference, Object)
passing a null instance and the type reference
created with the provided class |
default <T> Provider<? extends T> getProvider(java.lang.Class<T> key)
T - The key typekey - The key class<T> Provider<? extends T> getProvider(TypeReference<T> key)
T - The key typekey - The key type referencevoid injectStaticMembers(java.lang.Class<?> clazz)
injectMembers(TypeReference, Object)
passing a null instance and the type reference
created with the provided classclazz - The classdefault void injectMembers(java.lang.Object object)
<T> void injectMembers(TypeReference<T> type, T instance)
Injector, resolves the specified type
and to injects fields and methods in
the specified instance, if the instance is null, the injector handles
it like a static injectionT - The type of the injected objecttype - The injected typesinstance - The object that will be injected,
if it's null, the injector handles
it like a static injectiondefault <T> T getInstance(java.lang.Class<T> type)
TypeReference
and calls the overloaded method getInstance(TypeReference)T - The class parametertype - The instance class<T> T getInstance(TypeReference<T> type)
Injector for instantiating
and injecting a class.T - The type parametertype - The instance generic type