Class AbstractStaticDrivenValue<T>

  • Type Parameters:
    T - The type of the static value
    All Implemented Interfaces:
    DrivenValue<T>

    public class AbstractStaticDrivenValue<T>
    extends java.lang.Object
    implements DrivenValue<T>
    An AbstractStaticDrivenValue is a DrivenValue which never changes. Therefore, it is always ready and never dirty.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<T> getAndClear()
      Fetch the current driven value
      boolean isDirty()  
      boolean isReady()  
      void shutdown()
      Lifecycle hook to shut down the driven value
      void startup()
      Lifecycle hook to start up the driven value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractStaticDrivenValue

        public AbstractStaticDrivenValue​(@Nullable
                                         T value)
    • Method Detail

      • startup

        public void startup()
        Description copied from interface: DrivenValue
        Lifecycle hook to start up the driven value
        Specified by:
        startup in interface DrivenValue<T>
      • shutdown

        public void shutdown()
        Description copied from interface: DrivenValue
        Lifecycle hook to shut down the driven value
        Specified by:
        shutdown in interface DrivenValue<T>
      • isReady

        public boolean isReady()
        Specified by:
        isReady in interface DrivenValue<T>
        Returns:
        true if the driven value is ready to fetch
      • isDirty

        public boolean isDirty()
        Specified by:
        isDirty in interface DrivenValue<T>
        Returns:
        true if the driven value has changed since the last time it was fetched
      • getAndClear

        @Nonnull
        public java.util.Optional<T> getAndClear()
        Description copied from interface: DrivenValue
        Fetch the current driven value
        Specified by:
        getAndClear in interface DrivenValue<T>
        Returns:
        An Optional containing the current driven value, if present, or an empty Optional if the driven value is null / not present.