Class AbstractObservable

    • Field Detail

      • mutex

        protected final java.lang.Object mutex
    • Constructor Detail

      • AbstractObservable

        public AbstractObservable()
    • Method Detail

      • getObservedValues

        protected java.util.Set<java.lang.String> getObservedValues()
      • getObservers

        protected java.util.List<ValueObserver> getObservers​(java.lang.String key)
      • changed

        public void changed()
        Description copied from interface: Observable
        Informs observers that some values were changed.
        Specified by:
        changed in interface Observable
      • changed

        public void changed​(java.lang.String key)
        Description copied from interface: Observable
        Informs observers that some value has changed.
        Specified by:
        changed in interface Observable
        Parameters:
        key - name of value that has changed
      • addObserver

        public void addObserver​(java.lang.String key,
                                ValueObserver observer)
        Description copied from interface: Observable
        Registers a ValueObserver for changes of values. The observer will be notified each time a value related to the given key is changed.

        i.e. if the observer is registered for product.media.code it will be notified if value on any level of the key (product, product.media or product.media.code) was changed. Also for product.media it will be notified, if product.media.code has changed.

        Each model observer may be registered only once (next registrations will be ignored). Model observers are by default compared by their #equals(Object) method. To change this behaviour, observer may implement Identifiable interface to introduce observer's identity.

        Specified by:
        addObserver in interface Observable
        Parameters:
        key - attribute for changes of which the observer is interested
        observer - the observer to be notified about changes
        See Also:
        Observable.addObserver(ValueObserver)