Package org.jboss.msc.inject
Class RetainingInjector<T>
- java.lang.Object
-
- org.jboss.msc.inject.RetainingInjector<T>
-
- Type Parameters:
T
- the injected value type
- All Implemented Interfaces:
Injector<T>
- Direct Known Subclasses:
AddMethodInjector
,ConcurrentMapInjector
,InjectedValue
public abstract class RetainingInjector<T> extends java.lang.Object implements Injector<T>
An injector which retains its value.
-
-
Field Summary
Fields Modifier and Type Field Description private Value<T>
value
The stored value.private static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<RetainingInjector,Value>
valueUpdater
-
Constructor Summary
Constructors Constructor Description RetainingInjector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Value<T>
getStoredValue()
Get the value object stored in this injector.void
inject(T value)
Inject the given value.protected Value<T>
setStoredValue(Value<T> value)
Set the value object stored in this injector (must not benull
).void
uninject()
Uninject the given value (in other words, cancel or undo a previous injection).
-
-
-
Field Detail
-
valueUpdater
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<RetainingInjector,Value> valueUpdater
-
-
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
-
uninject
public void uninject()
Uninject the given value (in other words, cancel or undo a previous injection). Only called afterinject()
has been called.
-
getStoredValue
protected Value<T> getStoredValue()
Get the value object stored in this injector.- Returns:
- the value object
-
-