T - the value typepublic final class AddMethodInjector<T> extends RetainingInjector<T> implements Injector<T>
Injector - namely, the same injector cannot be used to inject multiple instances into
a collection.| Modifier and Type | Field and Description |
|---|---|
private java.lang.reflect.Method |
addMethod |
private java.lang.reflect.Method |
removeMethod |
private Value<?> |
target |
| Constructor and Description |
|---|
AddMethodInjector(Value<?> target,
java.lang.reflect.Method addMethod,
java.lang.reflect.Method removeMethod)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
inject(T value)
Inject the given value.
|
void |
uninject()
Uninject the given value (in other words, cancel or undo a previous injection).
|
getStoredValue, setStoredValueprivate final Value<?> target
private final java.lang.reflect.Method addMethod
private final java.lang.reflect.Method removeMethod
public AddMethodInjector(Value<?> target, java.lang.reflect.Method addMethod, java.lang.reflect.Method removeMethod)
target - the target upon which the add/remove methods should be invokedaddMethod - the add methodremoveMethod - the remove methodpublic void inject(T value)