Class WritableMap<K,V>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.map.ObservableMap<K,V>
org.eclipse.core.databinding.observable.map.WritableMap<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>
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 inherited from class org.eclipse.core.databinding.observable.map.ObservableMap
wrappedMap
-
Constructor Summary
ConstructorDescriptionConstructs a new WritableMap on the default realm.WritableMap
(Object keyType, Object valueType) Constructs a new WritableMap on the default realm with the specified key and value types.WritableMap
(Realm realm) Constructs a new WritableMap on the given realm.WritableMap
(Realm realm, Object keyType, Object valueType) Constructs a new WritableMap on the given realm with the specified key and value types. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(Object listenerType, IObservablesListener listener) void
clear()
Clears the map.protected Object
clone()
protected void
fireEvent
(ObservableEvent event) protected void
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.getRealm()
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.protected boolean
protected void
Associates the providedvalue
with thekey
.void
Adds the providedmap
's contents to this map.Removes the value with the providekey
.protected void
removeListener
(Object listenerType, IObservablesListener listener) Methods inherited from class org.eclipse.core.databinding.observable.map.ObservableMap
addMapChangeListener, containsKey, containsValue, entrySet, equals, fireMapChange, get, getterCalled, hashCode, isEmpty, isStale, keySet, removeMapChangeListener, setStale, 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
-
Constructor Details
-
WritableMap
public WritableMap()Constructs a new WritableMap on the default realm. -
WritableMap
Constructs a new WritableMap on the given realm.- Parameters:
realm
- the realm
-
WritableMap
Constructs a new WritableMap on the default realm with the specified key and value types.- Parameters:
keyType
- the type of the keys in this mapvalueType
- the type of the values in this map- Since:
- 1.2
-
WritableMap
Constructs a new WritableMap on the given realm with the specified key and value types.- Parameters:
realm
- the realmkeyType
- the type of the keys in this mapvalueType
- the type of the values in this map- Since:
- 1.2
-
-
Method Details
-
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> - Overrides:
getKeyType
in classObservableMap<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> - Overrides:
getValueType
in classObservableMap<K,
V> - Returns:
- the element type for the
values
of this observable map, ornull
if the values collection is untyped. - Since:
- 1.2
-
put
Associates the providedvalue
with thekey
. Must be invoked from the current realm. -
remove
Removes the value with the providekey
. Must be invoked from the current realm. -
clear
public void clear()Clears the map. Must be invoked from the current realm. -
putAll
Adds the providedmap
's contents to this map. Must be invoked from the current realm. -
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
-