Interface Value.Builder<T,B extends Value.Builder<T,B>>

Type Parameters:
T - the value type
B - the builder type
All Superinterfaces:
Observer.Builder<T,B>
All Known Subinterfaces:
ValueCollection.Builder<T,C,B>, ValueList.Builder<T>, ValueSet.Builder<T>
All Known Implementing Classes:
AbstractValue.AbstractBuilder
Enclosing interface:
Value<T>

public static interface Value.Builder<T,B extends Value.Builder<T,B>> extends Observer.Builder<T,B>
Builds a Value instance.
  • Method Details

    • value

      B value(@Nullable T value)
      Parameters:
      value - the initial value
      Returns:
      this builder instance
    • notify

      B notify(Value.Notify notify)
      Parameters:
      notify - the notify policy for this value, default Value.Notify.CHANGED
      Returns:
      this builder instance
    • validator

      B validator(Value.Validator<? super T> validator)
      Adds a validator to the resulting value
      Parameters:
      validator - the validator to add
      Returns:
      this builder instance
    • locked

      B locked(boolean locked)
      Parameters:
      locked - true if the value should be locked
      Returns:
      this builder instance
      See Also:
    • link

      B link(Value<T> originalValue)
      Links the given value to the resulting value
      Parameters:
      originalValue - the original value to link
      Returns:
      this builder instance
      See Also:
    • link

      B link(Observable<T> observable)
      Links the given observable to the resulting value
      Parameters:
      observable - the value to link
      Returns:
      this builder instance
      See Also:
    • changeListener

      B changeListener(Runnable listener)
      Parameters:
      listener - a change listener to add
      Returns:
      this builder instance
      See Also:
    • changeConsumer

      B changeConsumer(Consumer<ValueChange<? super T>> consumer)
      Parameters:
      consumer - a change consumer to add
      Returns:
      this builder instance
      See Also:
    • weakChangeListener

      B weakChangeListener(Runnable weakListener)
      Parameters:
      weakListener - a weak change listener to add
      Returns:
      this builder instance
      See Also:
    • weakChangeConsumer

      B weakChangeConsumer(Consumer<ValueChange<? super T>> weakConsumer)
      Parameters:
      weakConsumer - a weak change consumer to add
      Returns:
      this builder instance
      See Also:
    • build

      Value<T> build()
      Specified by:
      build in interface Observer.Builder<T,B extends Value.Builder<T,B>>
      Returns:
      a new Value instance based on this builder