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
-
Constructor Summary
ConstructorDescriptionObservableMap
(Map<K, V> wrappedMap) ObservableMap
(Realm realm, Map<K, V> wrappedMap) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(Object listenerType, IObservablesListener listener) void
addMapChangeListener
(IMapChangeListener<? super K, ? super V> listener) void
clear()
protected Object
clone()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
protected void
fireEvent
(ObservableEvent event) protected void
fireMapChange
(MapDiff<K, V> diff) protected void
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.getRealm()
protected void
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.int
hashCode()
protected boolean
boolean
isEmpty()
boolean
isStale()
Returns the stale state.keySet()
protected void
void
protected void
removeListener
(Object listenerType, IObservablesListener listener) void
removeMapChangeListener
(IMapChangeListener<? super K, ? super V> listener) void
setStale
(boolean stale) Sets the stale state.int
size()
values()
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireChange, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods 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; notnull
wrappedMap
- backing store for the map data, used to implement all map operations
-
-
Method Details
-
addMapChangeListener
- Specified by:
addMapChangeListener
in interfaceIObservableMap<K,
V> - Parameters:
listener
- the change listener to add; notnull
-
removeMapChangeListener
- Specified by:
removeMapChangeListener
in interfaceIObservableMap<K,
V> - Parameters:
listener
- the change listener to remove; notnull
-
getKeyType
Description copied from interface:IObservableMap
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.- Specified by:
getKeyType
in interfaceIObservableMap<K,
V> - Returns:
- the element type for the
keyset
of this observable map, ornull
if the keyset is untyped. - Since:
- 1.2
-
getValueType
Description copied from interface:IObservableMap
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.- Specified by:
getValueType
in interfaceIObservableMap<K,
V> - Returns:
- the element type for the
values
of this observable map, ornull
if the values collection is untyped. - Since:
- 1.2
-
getterCalled
protected void getterCalled() -
fireMapChange
-
containsKey
- Specified by:
containsKey
in interfaceIObservableMap<K,
V> - Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceIObservableMap<K,
V> - Specified by:
containsValue
in 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:
isStale
in 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:
clone
in classObject
- Throws:
CloneNotSupportedException
-