Package org.jboss.msc.value
Class InjectedValue<T>
- java.lang.Object
-
- org.jboss.msc.value.InjectedValue<T>
-
- Type Parameters:
T
- the value type
@Deprecated public final class InjectedValue<T> extends Object implements Injector<T>, Value<T>
Deprecated.UseServiceBuilder.requires(org.jboss.msc.service.ServiceName)
method instead. This class will be removed in a future release.A value which is injected from another source. The value may only be read if the injector has populated it.- Author:
- David M. Lloyd
-
-
Constructor Summary
Constructors Constructor Description InjectedValue()
Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description T
getOptionalValue()
Deprecated.Get the value if it was injected, or returnnull
if it was not.protected Value<T>
getStoredValue()
Get the value object stored in this injector.T
getValue()
Deprecated.Get the actual dependency value.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
setValue(Value<T> value)
Deprecated.Set the value to be injected to aValue
instance.void
uninject()
Uninject the given value (in other words, cancel or undo a previous injection).
-
-
-
Method Detail
-
getValue
public T getValue() throws IllegalStateException
Deprecated.Get the actual dependency value.- Specified by:
getValue
in interfaceValue<T>
- Returns:
- the actual dependency value
- Throws:
IllegalStateException
- if the value is time-sensitive and the current state does not allow retrieval.
-
setValue
public void setValue(Value<T> value)
Deprecated.Set the value to be injected to aValue
instance.- Parameters:
value
- the value to set, cannot benull
-
getOptionalValue
public T getOptionalValue()
Deprecated.Get the value if it was injected, or returnnull
if it was not.- Returns:
- the value or
null
if it was not injected
-
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
-
-