JBoss Modular Service Kernel API 1.0.0.CR2

org.jboss.msc.inject
Class MethodInjector<T>

java.lang.Object
  extended by org.jboss.msc.inject.MethodInjector<T>
Type Parameters:
T - the injection type
All Implemented Interfaces:
Injector<T>

public final class MethodInjector<T>
extends Object
implements Injector<T>

An injector which invokes a method. The value being injected can be specified by Values.injectedValue(). The value being invoked upon can be specified by Values.thisValue().

Author:
David M. Lloyd

Constructor Summary
MethodInjector(Method method, Value<?> targetValue, Value<?> injectedValue, List<? extends Value<?>> parameterList)
          Construct a new instance.
 
Method Summary
 void inject(T value)
          Inject the given value.
 void uninject()
          Uninject the given value (in other words, cancel or undo a previous injection).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInjector

public MethodInjector(Method method,
                      Value<?> targetValue,
                      Value<?> injectedValue,
                      List<? extends Value<?>> parameterList)
Construct a new instance.

Parameters:
method - the method to invoke
targetValue - the value of the invocation target (the object being called upon) - use Values.nullValue() for static methods
injectedValue - the value to use for Values.injectedValue() on uninjection (usually Values.nullValue())
parameterList - the list of parameter values (any null parameters should use Values.nullValue())
Method Detail

inject

public void inject(T value)
            throws InjectionException
Inject the given value.

Specified by:
inject in interface Injector<T>
Parameters:
value - the value
Throws:
InjectionException - if the injection failed

uninject

public void uninject()
Uninject the given value (in other words, cancel or undo a previous injection). Only called after inject() has been called.

Specified by:
uninject in interface Injector<T>

JBoss Modular Service Kernel API 1.0.0.CR2

Copyright © 2011 JBoss, a division of Red Hat, Inc.