Package org.jboss.msc.inject
Class AddMethodInjector<T>
- java.lang.Object
-
- org.jboss.msc.inject.RetainingInjector<T>
-
- org.jboss.msc.inject.AddMethodInjector<T>
-
- Type Parameters:
T- the value type
- All Implemented Interfaces:
Injector<T>
public final class AddMethodInjector<T> extends RetainingInjector<T> implements Injector<T>
An injector which calls an add/remove method pair on inject/uninject. Note that this class still adheres to the contract ofInjector- namely, the same injector cannot be used to inject multiple instances into a collection.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.MethodaddMethodprivate java.lang.reflect.MethodremoveMethodprivate Value<?>target
-
Constructor Summary
Constructors Constructor Description AddMethodInjector(Value<?> target, java.lang.reflect.Method addMethod, java.lang.reflect.Method removeMethod)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinject(T value)Inject the given value.voiduninject()Uninject the given value (in other words, cancel or undo a previous injection).-
Methods inherited from class org.jboss.msc.inject.RetainingInjector
getStoredValue, setStoredValue
-
-
-
-
Field Detail
-
target
private final Value<?> target
-
addMethod
private final java.lang.reflect.Method addMethod
-
removeMethod
private final java.lang.reflect.Method removeMethod
-
-
Constructor Detail
-
AddMethodInjector
public AddMethodInjector(Value<?> target, java.lang.reflect.Method addMethod, java.lang.reflect.Method removeMethod)
Construct a new instance.- Parameters:
target- the target upon which the add/remove methods should be invokedaddMethod- the add methodremoveMethod- the remove method
-
-
Method Detail
-
inject
public void inject(T value)
Inject the given value.
-
-