Class ObservableMap<K,​V>

    • Field Detail

      • wrappedMap

        protected java.util.Map<K,​V> wrappedMap
    • Constructor Detail

      • ObservableMap

        public ObservableMap​(java.util.Map<K,​V> wrappedMap)
        Parameters:
        wrappedMap - backing store for the map data, used to implement all map operations
      • ObservableMap

        public ObservableMap​(Realm realm,
                             java.util.Map<K,​V> wrappedMap)
        Parameters:
        realm - the realm to use; not null
        wrappedMap - backing store for the map data, used to implement all map operations
    • Method Detail

      • getKeyType

        public java.lang.Object getKeyType()
        Description copied from interface: IObservableMap
        Returns the element type for the keyset of this observable map, or null if the keyset is untyped.
        Specified by:
        getKeyType in interface IObservableMap<K,​V>
        Returns:
        the element type for the keyset of this observable map, or null if the keyset is untyped.
        Since:
        1.2
      • getValueType

        public java.lang.Object getValueType()
        Description copied from interface: IObservableMap
        Returns the element type for the values of this observable map, or null if the values collection is untyped.
        Specified by:
        getValueType in interface IObservableMap<K,​V>
        Returns:
        the element type for the values of this observable map, or null if the values collection is untyped.
        Since:
        1.2
      • getterCalled

        protected void getterCalled()
      • fireMapChange

        protected void fireMapChange​(MapDiff<K,​V> diff)
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface IObservableMap<K,​V>
        Specified by:
        containsKey in interface java.util.Map<K,​V>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface IObservableMap<K,​V>
        Specified by:
        containsValue in interface java.util.Map<K,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()
        Specified by:
        entrySet in interface IObservableMap<K,​V>
        Specified by:
        entrySet in interface java.util.Map<K,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface IObservableMap<K,​V>
        Specified by:
        get in interface java.util.Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface IObservableMap<K,​V>
        Specified by:
        isEmpty in interface java.util.Map<K,​V>
      • keySet

        public java.util.Set<K> keySet()
        Specified by:
        keySet in interface IObservableMap<K,​V>
        Specified by:
        keySet in interface java.util.Map<K,​V>
      • size

        public int size()
        Specified by:
        size in interface IObservableMap<K,​V>
        Specified by:
        size in interface java.util.Map<K,​V>
      • values

        public java.util.Collection<V> values()
        Specified by:
        values in interface IObservableMap<K,​V>
        Specified by:
        values in interface java.util.Map<K,​V>
      • isStale

        public boolean isStale()
        Returns the stale state. Must be invoked from the current realm.
        Specified by:
        isStale in interface IObservable
        Returns:
        stale state
      • setStale

        public void setStale​(boolean stale)
        Sets the stale state. Must be invoked from the current realm.
        Parameters:
        stale - The stale state to set. This will fire a stale event if the given boolean is true and this observable set was not already stale.
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface IObservableMap<K,​V>
        Specified by:
        put in interface java.util.Map<K,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface IObservableMap<K,​V>
        Specified by:
        remove in interface java.util.Map<K,​V>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> arg0)
        Specified by:
        putAll in interface java.util.Map<K,​V>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface IObservableMap<K,​V>
        Specified by:
        equals in interface java.util.Map<K,​V>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface IObservableMap<K,​V>
        Specified by:
        hashCode in interface java.util.Map<K,​V>
        Overrides:
        hashCode in class java.lang.Object
      • addListener

        protected void addListener​(java.lang.Object listenerType,
                                   IObservablesListener listener)
        Parameters:
        listenerType - arbitrary object to identify a type of the listener
        listener - the listener to add; not null
      • removeListener

        protected void removeListener​(java.lang.Object listenerType,
                                      IObservablesListener listener)
        Parameters:
        listenerType - arbitrary object to identify a type of the listener
        listener - the listener to remove; not null
      • hasListeners

        protected boolean hasListeners()
      • firstListenerAdded

        protected void firstListenerAdded()
      • lastListenerRemoved

        protected void lastListenerRemoved()
      • getRealm

        public Realm getRealm()
        Returns:
        Returns the realm.
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException