Class DerbyObservable

  • Direct Known Subclasses:
    BaseContainerHandle, RawTransaction

    public class DerbyObservable
    extends java.lang.Object

    Created to provide the Observable behavior which Derby has depended on since Java 1.2 but which as deprecated in JDK 9 build 118. A DerbyObservable is an object whose state changes are being tracked.

    • Constructor Summary

      Constructors 
      Constructor Description
      DerbyObservable()
      No-arg constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addObserver​(DerbyObserver observer)
      Add another observer who wants to be told about changes to this object.
      int countObservers()
      Return the number of observers who are watching this object.
      void deleteObserver​(DerbyObserver observer)
      Remove a specific observer from the list of watchers.
      void notifyObservers()
      This method is equivalent to notifyObservers(null);
      void notifyObservers​(java.lang.Object extraInfo)
      If this object has changed, then notify all observers.
      protected void setChanged()
      When the object state changes, the object calls this method in order to flag that fact.
      • Methods inherited from class java.lang.Object

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

      • _hasChanged

        private boolean _hasChanged
      • _observers

        private java.util.ArrayList<DerbyObserver> _observers
    • Constructor Detail

      • DerbyObservable

        public DerbyObservable()
        No-arg constructor
    • Method Detail

      • addObserver

        public void addObserver​(DerbyObserver observer)
        Add another observer who wants to be told about changes to this object.
        Parameters:
        observer - The object which wants to be notified when this object changes
        Throws:
        java.lang.IllegalArgumentException - If the argument is bad (e.g., null)
      • countObservers

        public int countObservers()
        Return the number of observers who are watching this object.
        Returns:
        The number of watchers
      • deleteObserver

        public void deleteObserver​(DerbyObserver observer)
        Remove a specific observer from the list of watchers. Null is ignored.
        Parameters:
        observer - The observer to remove.
      • notifyObservers

        public void notifyObservers()
        This method is equivalent to notifyObservers(null);
      • notifyObservers

        public void notifyObservers​(java.lang.Object extraInfo)
        If this object has changed, then notify all observers. Pass them this object and the extraInfo. This object is then marked as unchanged again.
        Parameters:
        extraInfo - Extra information to be passed to the observer's callback method.
      • setChanged

        protected void setChanged()
        When the object state changes, the object calls this method in order to flag that fact. After this method has been called, then the notifyObservers() will wake up the observers which are watching this object.