Package org.jboss.msc.inject
Class MethodInjector<T>
- java.lang.Object
-
- org.jboss.msc.inject.MethodInjector<T>
-
- Type Parameters:
T- the injection type
- All Implemented Interfaces:
Injector<T>
public final class MethodInjector<T> extends java.lang.Object implements Injector<T>
An injector which invokes a method. The value being injected can be specified byValues.injectedValue(). The value being invoked upon can be specified byValues.thisValue().
-
-
Field Summary
Fields Modifier and Type Field Description private Value<?>injectedValueprivate java.lang.reflect.Methodmethodprivate java.util.List<? extends Value<?>>parameterListprivate Value<?>targetValue
-
Constructor Summary
Constructors Constructor Description MethodInjector(java.lang.reflect.Method method, Value<?> targetValue, Value<?> injectedValue, java.util.List<? extends Value<?>> parameterList)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).
-
-
-
Constructor Detail
-
MethodInjector
public MethodInjector(java.lang.reflect.Method method, Value<?> targetValue, Value<?> injectedValue, java.util.List<? extends Value<?>> parameterList)Construct a new instance.- Parameters:
method- the method to invoketargetValue- the value of the invocation target (the object being called upon) - useValues.nullValue()for static methodsinjectedValue- the value to use forValues.injectedValue()on uninjection (usuallyValues.nullValue())parameterList- the list of parameter values (anynullparameters should useValues.nullValue())
-
-
Method Detail
-
inject
public void inject(T value) throws InjectionException
Inject the given value.- Specified by:
injectin interfaceInjector<T>- Parameters:
value- the value- Throws:
InjectionException- if the injection failed
-
-