Interface ObservableProperty<T>

All Superinterfaces:
Functor<T>, MutableProperty<T>, Property<T>
All Known Subinterfaces:
ConfigOption<T>, ObservableBooleanProperty, ObservableFloatProperty, ObservableIntProperty, ObservableObjectProperty<T>, ObservableStringProperty, SimpleObservableProperty<T>
All Known Implementing Classes:
BooleanConfigOption, DeserializedBooleanProperty, DeserializedFloatProperty, DeserializedIntProperty, DeserializedObjectProperty, DeserializedStringProperty, FileDeserializer, FloatConfigOption, HotFileDeserializer, IntConfigOption, ObjectConfigOption, SelectionProperty, SimpleObservableBooleanProperty, SimpleObservableFloatProperty, SimpleObservableIntProperty, SimpleObservableObjectProperty, SimpleObservableStringProperty, SingleSelectionProperty, StringConfigOption

public interface ObservableProperty<T> extends MutableProperty<T>
A property that triggers observers whenever its value changes.
  • Field Details

  • Method Details

    • read

      default void read(Observer<T> reader)
      Adds an observer that is immediately called with the current value.

      This is the equivalent of calling Property.getValue(), then doing something with that value, and then adding an observer which does the same thing each time the value changes.

      Parameters:
      reader - The observer
    • addObserver

      Observer<T> addObserver(Observer<T> observer)
    • removeObserver

      void removeObserver(Observer<T> observer)