Class InjectedValue<T>

java.lang.Object
org.jboss.msc.value.InjectedValue<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
Injector<T>, Value<T>

@Deprecated public final class InjectedValue<T> extends Object implements Injector<T>, Value<T>
Deprecated.
Use ServiceBuilder.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 Details

    • InjectedValue

      public InjectedValue()
      Deprecated.
      Construct a new instance.
  • Method Details

    • getValue

      public T getValue() throws IllegalStateException
      Deprecated.
      Get the actual dependency value.
      Specified by:
      getValue in interface Value<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 a Value instance.
      Parameters:
      value - the value to set, cannot be null
    • getOptionalValue

      public T getOptionalValue()
      Deprecated.
      Get the value if it was injected, or return null 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 interface Injector<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 after inject() has been called.
      Specified by:
      uninject in interface Injector<T>
    • getStoredValue

      protected Value<T> getStoredValue()
      Get the value object stored in this injector.
      Returns:
      the value object
    • setStoredValue

      protected Value<T> setStoredValue(Value<T> value)
      Set the value object stored in this injector (must not be null).
      Parameters:
      value - the value object (must not be null)
      Returns:
      the old value object, or null if none was stored