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<?>
injectedValue
private java.lang.reflect.Method
method
private java.util.List<? extends Value<?>>
parameterList
private 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 void
inject(T value)
Inject the given value.void
uninject()
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 (anynull
parameters should useValues.nullValue()
)
-
-
Method Detail
-
inject
public void inject(T value) throws InjectionException
Inject the given value.- Specified by:
inject
in interfaceInjector<T>
- Parameters:
value
- the value- Throws:
InjectionException
- if the injection failed
-
-