Interface OffsetValue<V>

Type Parameters:
V - the value type
All Superinterfaces:
Supplier<V>, Value<V>
All Known Implementing Classes:
OffsetValue.DefaultOffsetValue, OffsetValue.DurationOffsetValue, OffsetValue.InstantOffsetValue, OffsetValue.TemporalOffsetValue

public interface OffsetValue<V> extends Value<V>
Encapsulates a value that is offset from some basis, and updated via Value.set(Object).
Author:
Paul Ferraro
  • Method Details

    • getBasis

      V getBasis()
      Returns the basis from which the associated offset will be applied.
      Returns:
      the basis from which the associated offset will be applied.
    • get

      default V get()
      Returns the current value, computed by applying the current offset to the basis.
      Specified by:
      get in interface Supplier<V>
      Returns:
      the computed value
    • getOffset

      Offset<V> getOffset()
      The current offset.
      Returns:
      an offset
    • setOffset

      default void setOffset(Offset<V> offset)
      Sets the current offset.
      Parameters:
      offset - an offset
    • rebase

      OffsetValue<V> rebase()
      Returns a new offset value based on the current value.
      Returns:
      a new offset value
    • from

      static OffsetValue<Duration> from(Duration duration)
      Creates a duration-based offset value from the specified basis.
      Parameters:
      duration - the offset basis
      Returns:
      a duration-based offset value from the specified basis.
    • from

      static OffsetValue<Instant> from(Instant instant)
      Creates a instant-based offset value from the specified basis.
      Parameters:
      instant - the offset basis
      Returns:
      a instant-based offset value from the specified basis.