Class SimpleObservable<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addObserver​(Observer<? super T> observer)
      Add an observer to this observable.
      T get()
      Gets the current value of this observable.
      void removeObserver​(Observer<? super T> observer)
      Removes an observer from this observable.
      void set​(T value)
      Sets the value of this observable.
      • Methods inherited from class java.lang.Object

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

      • addObserver

        public void addObserver​(Observer<? super T> observer)
        Description copied from interface: Observable
        Add an observer to this observable. It will be notified of any future changes to the value of this observable. Listeners will be fired in the order in which they were added, and on the thread that updates the observed value. Because of this, listeners should take as little time as possible to run (unless submitting a long-running task to a worker thread).
        Specified by:
        addObserver in interface Observable<T>
      • removeObserver

        public void removeObserver​(Observer<? super T> observer)
        Description copied from interface: Observable
        Removes an observer from this observable. The observer will not be updated with future changes to the value of this observable.
        Specified by:
        removeObserver in interface Observable<T>
      • get

        public T get()
        Description copied from interface: Observable
        Gets the current value of this observable.
        Specified by:
        get in interface Observable<T>
      • set

        public void set​(T value)
        Description copied from interface: Observable
        Sets the value of this observable. If it's not equal to the current value, all observers will be notified of the change.
        Specified by:
        set in interface Observable<T>