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 TgetOptionalValue()Get the value if it was injected, or returnnullif it was not.TgetValue()Get the actual value.voidsetValue(Value<T> value)Set the value to be injected to aValueinstance.-
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 aValueinstance.- 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 returnnullif it was not.- Returns:
- the value or
nullif it was not injected
-
-