Class ObservableMap<K,V>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.map.ObservableMap<K,V>
- Type Parameters:
K- the type of the keys in this mapV- the type of the values in this map
- All Implemented Interfaces:
Map<K,,V> IObservable,IObservableMap<K,V>
- Direct Known Subclasses:
BidirectionalMap,CompositeMap,WritableMap
This class is thread safe. All state accessing methods must be invoked from
the current realm. Methods for adding and removing
listeners may be invoked from any thread.
- Since:
- 1.0
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionObservableMap(Map<K, V> wrappedMap) ObservableMap(Realm realm, Map<K, V> wrappedMap) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListener(Object listenerType, IObservablesListener listener) voidaddMapChangeListener(IMapChangeListener<? super K, ? super V> listener) voidclear()protected Objectclone()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanprotected voidfireEvent(ObservableEvent event) protected voidfireMapChange(MapDiff<K, V> diff) protected voidReturns the element type for thekeysetof this observable map, ornullif the keyset is untyped.getRealm()protected voidReturns the element type for thevaluesof this observable map, ornullif the values collection is untyped.inthashCode()protected booleanbooleanisEmpty()booleanisStale()Returns the stale state.keySet()protected voidvoidprotected voidremoveListener(Object listenerType, IObservablesListener listener) voidremoveMapChangeListener(IMapChangeListener<? super K, ? super V> listener) voidsetStale(boolean stale) Sets the stale state.intsize()values()Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireChange, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
wrappedMap
-
-
Constructor Details
-
ObservableMap
- Parameters:
wrappedMap- backing store for the map data, used to implement all map operations
-
ObservableMap
- Parameters:
realm- the realm to use; notnullwrappedMap- backing store for the map data, used to implement all map operations
-
-
Method Details
-
addMapChangeListener
- Specified by:
addMapChangeListenerin interfaceIObservableMap<K,V> - Parameters:
listener- the change listener to add; notnull
-
removeMapChangeListener
- Specified by:
removeMapChangeListenerin interfaceIObservableMap<K,V> - Parameters:
listener- the change listener to remove; notnull
-
getKeyType
Description copied from interface:IObservableMapReturns the element type for thekeysetof this observable map, ornullif the keyset is untyped.- Specified by:
getKeyTypein interfaceIObservableMap<K,V> - Returns:
- the element type for the
keysetof this observable map, ornullif the keyset is untyped. - Since:
- 1.2
-
getValueType
Description copied from interface:IObservableMapReturns the element type for thevaluesof this observable map, ornullif the values collection is untyped.- Specified by:
getValueTypein interfaceIObservableMap<K,V> - Returns:
- the element type for the
valuesof this observable map, ornullif the values collection is untyped. - Since:
- 1.2
-
getterCalled
protected void getterCalled() -
fireMapChange
-
containsKey
- Specified by:
containsKeyin interfaceIObservableMap<K,V> - Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceIObservableMap<K,V> - Specified by:
containsValuein interfaceMap<K,V>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
size
public int size() -
values
-
isStale
public boolean isStale()Returns the stale state. Must be invoked from the current realm.- Specified by:
isStalein interfaceIObservable- 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
-
remove
-
clear
public void clear() -
putAll
-
equals
-
hashCode
public int hashCode() -
addListener
- Parameters:
listenerType- arbitrary object to identify a type of the listenerlistener- the listener to add; notnull
-
removeListener
- Parameters:
listenerType- arbitrary object to identify a type of the listenerlistener- the listener to remove; notnull
-
hasListeners
protected boolean hasListeners() -
fireEvent
-
firstListenerAdded
protected void firstListenerAdded() -
lastListenerRemoved
protected void lastListenerRemoved() -
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-