Package org.jboss.msc.value
Class InjectedValue<T>
- java.lang.Object
-
- org.jboss.msc.inject.RetainingInjector<T>
-
- org.jboss.msc.value.InjectedValue<T>
-
- Type Parameters:
T
- the value type
public final class InjectedValue<T> extends RetainingInjector<T> implements Injector<T>, Value<T>
A value which is injected from another source. The value may only be read if the injector has populated it.
-
-
Constructor Summary
Constructors Constructor Description InjectedValue()
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getOptionalValue()
Get the value if it was injected, or returnnull
if it was not.T
getValue()
Get the actual value.void
setValue(Value<T> value)
Set the value to be injected to aValue
instance.-
Methods inherited from class org.jboss.msc.inject.RetainingInjector
getStoredValue, inject, setStoredValue, uninject
-
-
-
-
Method Detail
-
getValue
public T getValue() throws java.lang.IllegalStateException
Get the actual value.
-
setValue
public void setValue(Value<T> value)
Set the value to be injected to aValue
instance.- Parameters:
value
- the value to set, cannot benull
(though it may beValues.nullValue()
)
-
getOptionalValue
public T getOptionalValue()
Get the value if it was injected, or returnnull
if it was not.- Returns:
- the value or
null
if it was not injected
-
-