public class SimpleResourceInjector extends AbstractResourceInjector
javax.inject.Inject annotated fields and setter methods to inject
resources. If a field is annotated with javax.inject.Inject, a Resource of the type of that field is injected
into it, if present. If a method is annotated with javax.inject.Inject, the method is invoked with a Resource
of the type of the first parameter, if present.javax.inject.Inject| Constructor and Description |
|---|
SimpleResourceInjector(Collection<?> resources)
Initializes the resource injector to inject to given
resources. |
SimpleResourceInjector(Object... resources)
Initializes the resource injector to inject to given
resources. |
| Modifier and Type | Method and Description |
|---|---|
protected <R> Optional<R> |
findResource(Class<R> requiredType)
Returns a resource of given
requiredType or an empty Optional if the resource is not registered with the
injector. |
injectorAnnotationNames, injectResourcespublic SimpleResourceInjector(Object... resources)
resources.resources - The resources to injectpublic SimpleResourceInjector(Collection<?> resources)
resources.
Note that any changes to the given collection will not be reflected by this injector.
resources - The resources to injectprotected <R> Optional<R> findResource(Class<R> requiredType)
AbstractResourceInjectorrequiredType or an empty Optional if the resource is not registered with the
injector.findResource in class AbstractResourceInjectorR - the resource typerequiredType - the class of the resource to findCopyright © 2010–2018. All rights reserved.