T
- the annotation typepublic class Injector<T extends java.lang.annotation.Annotation>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Injector.Target<T>
The Target class describes the target injection point.
|
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.Class<T> |
annotation |
(package private) Converter |
converter |
(package private) java.util.function.Function<Injector.Target<T>,java.lang.Object> |
domain |
Constructor and Description |
---|
Injector(Converter converter,
java.util.function.Function<Injector.Target<T>,java.lang.Object> domain,
java.lang.Class<T> annotation)
Create a new Injector
|
Injector(java.util.function.Function<Injector.Target<T>,java.lang.Object> domain,
java.lang.Class<T> annotation)
Create a new Injector with a default converter
|
Modifier and Type | Method and Description |
---|---|
private java.util.List<java.lang.Class<?>> |
getAbove(java.lang.Class<?> clazz) |
private java.util.Collection<java.lang.reflect.Field> |
getFields(java.lang.Class<?> clazz) |
private java.util.Collection<java.lang.reflect.Method> |
getMethods(java.lang.Class<?> clazz) |
private java.lang.Object |
getValue(Injector.Target<T> param) |
void |
inject(java.lang.Object target)
Inject an object.
|
private java.lang.Object[] |
invoke(java.lang.Object target,
Injector.Target<T> param,
java.lang.reflect.Executable method) |
<F> F |
newInstance(java.lang.Class<F> type) |
final Converter converter
final java.lang.Class<T extends java.lang.annotation.Annotation> annotation
final java.util.function.Function<Injector.Target<T extends java.lang.annotation.Annotation>,java.lang.Object> domain
public Injector(Converter converter, java.util.function.Function<Injector.Target<T>,java.lang.Object> domain, java.lang.Class<T> annotation)
converter
- the converter to use for conversionsdomain
- the domain function that retrieves valuesannotation
- the annotation that triggers a call to the domainpublic Injector(java.util.function.Function<Injector.Target<T>,java.lang.Object> domain, java.lang.Class<T> annotation)
domain
- the domain function that retrieves valuesannotation
- the annotation that triggers a call to the domainpublic void inject(java.lang.Object target) throws java.lang.Exception
target
- the target object to injectjava.lang.Exception
public <F> F newInstance(java.lang.Class<F> type) throws java.lang.Exception
java.lang.Exception
private java.util.Collection<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz)
private java.util.Collection<java.lang.reflect.Method> getMethods(java.lang.Class<?> clazz)
private java.util.List<java.lang.Class<?>> getAbove(java.lang.Class<?> clazz)
private java.lang.Object getValue(Injector.Target<T> param) throws java.lang.Exception
java.lang.Exception
private java.lang.Object[] invoke(java.lang.Object target, Injector.Target<T> param, java.lang.reflect.Executable method) throws java.lang.Exception, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.Exception
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException