public interface Injector
For example, a command might accept an integer as an argument, and so an appropriate binding for that parameter would have a provider that parsed the argument as an integer and returned it.
| Modifier and Type | Method and Description |
|---|---|
<T> Binding<T> |
getBinding(Class<T> type)
Get the binding for the given class, if one exists.
|
<T> Binding<T> |
getBinding(Key<T> key)
Get the binding for the given key, if one exists.
|
<T> T |
getInstance(Class<T> type,
CommandArgs arguments,
List<? extends Annotation> modifiers)
Attempt to provide a value for the given class using the given
arguments.
|
<T> T |
getInstance(Key<T> key,
CommandArgs arguments,
List<? extends Annotation> modifiers)
Attempt to provide a value for the given key using the given
arguments.
|
<T> Provider<T> |
getProvider(Class<T> type)
Get the provider for the given class, if one exists.
|
<T> Provider<T> |
getProvider(Key<T> key)
Get the provider for the given key, if one exists.
|
void |
install(Module module)
Install a module into the injector.
|
void install(Module module)
module - The module@Nullable <T> Binding<T> getBinding(Key<T> key)
T - The type provided forkey - The key@Nullable <T> Binding<T> getBinding(Class<T> type)
T - The type provided fortype - The class@Nullable <T> Provider<T> getProvider(Key<T> key)
T - The type provided forkey - The key@Nullable <T> Provider<T> getProvider(Class<T> type)
T - The type provided fortype - The class<T> T getInstance(Key<T> key, CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException
T - The type providedkey - The keyarguments - The argumentsmodifiers - The modifier annotations on the parameterArgumentException - If there is a problem with the argumentProvisionException - If there is a problem with the provider<T> T getInstance(Class<T> type, CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException
T - The type providedtype - The classarguments - The argumentsmodifiers - The modifier annotations on the parameterArgumentException - If there is a problem with the argumentProvisionException - If there is a problem with the providerCopyright © 2015. All Rights Reserved.