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 of Injector
- namely, the same injector cannot be used to inject multiple instances into
a collection.
- Author:
- David M. Lloyd
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 |
AddMethodInjector
public AddMethodInjector(Value<?> target,
Method addMethod,
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
inject
public void inject(T value)
- Inject the given value.
- Specified by:
inject
in interface Injector<T>
- Overrides:
inject
in class RetainingInjector<T>
- Parameters:
value
- the value
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>
- Overrides:
uninject
in class RetainingInjector<T>
Copyright © 2011 JBoss, a division of Red Hat, Inc.