K
- the type of the keys in this mapV
- the type of the values in this mappublic class ObservableMap<K,V> extends AbstractObservable implements 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.
Modifier and Type | Field and Description |
---|---|
protected Map<K,V> |
wrappedMap |
Constructor and Description |
---|
ObservableMap(Map<K,V> wrappedMap) |
ObservableMap(Realm realm,
Map<K,V> wrappedMap) |
Modifier and Type | Method and Description |
---|---|
protected 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) |
void |
dispose()
Disposes of this observable object, removing all listeners registered
with this object, and all listeners this object might have registered on
other objects.
|
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
protected void |
fireEvent(ObservableEvent event) |
protected void |
fireMapChange(MapDiff<K,V> diff) |
protected void |
firstListenerAdded() |
V |
get(Object key) |
Object |
getKeyType()
Returns the element type for the
keyset of this
observable map, or null if the keyset is untyped. |
Realm |
getRealm() |
protected void |
getterCalled() |
Object |
getValueType()
Returns the element type for the
values of this
observable map, or null if the values collection is untyped. |
int |
hashCode() |
protected boolean |
hasListeners() |
boolean |
isEmpty() |
boolean |
isStale()
Returns the stale state.
|
Set<K> |
keySet() |
protected void |
lastListenerRemoved() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> arg0) |
V |
remove(Object key) |
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() |
Collection<V> |
values() |
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireChange, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
public void addMapChangeListener(IMapChangeListener<? super K,? super V> listener)
addMapChangeListener
in interface IObservableMap<K,V>
public void removeMapChangeListener(IMapChangeListener<? super K,? super V> listener)
removeMapChangeListener
in interface IObservableMap<K,V>
public Object getKeyType()
IObservableMap
keyset
of this
observable map, or null
if the keyset is untyped.getKeyType
in interface IObservableMap<K,V>
keyset
of this
observable map, or null
if the keyset is untyped.public Object getValueType()
IObservableMap
values
of this
observable map, or null
if the values collection is untyped.getValueType
in interface IObservableMap<K,V>
values
of this
observable map, or null
if the values collection is
untyped.protected void getterCalled()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in interface IObservableMap<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
containsValue
in interface IObservableMap<K,V>
public boolean isEmpty()
public int size()
public Collection<V> values()
public boolean isStale()
isStale
in interface IObservable
public void setStale(boolean stale)
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.public boolean equals(Object o)
public int hashCode()
public void dispose()
IObservable
dispose
in interface IObservable
dispose
in class AbstractObservable
protected void addListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected void removeListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected boolean hasListeners()
protected void fireEvent(ObservableEvent event)
protected void firstListenerAdded()
protected void lastListenerRemoved()
public Realm getRealm()
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.