Class BidiObservableMap<K,V>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.DecoratingObservable
org.eclipse.core.databinding.observable.map.DecoratingObservableMap<K,V>
org.eclipse.core.databinding.observable.map.BidiObservableMap<K,V>
- Type Parameters:
K- type of the keys in the mapV- type of the values in the map
- All Implemented Interfaces:
Map<K,,V> IDecoratingObservable,IObservable,IObservableMap<K,V>
An
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.2
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBidiObservableMap(IObservableMap<K, V> wrappedMap) Constructs a BidirectionalMap tracking the given observable map. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListener(Object listenerType, IObservablesListener listener) protected Objectclone()booleancontainsValue(Object value) voiddispose()Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.protected voidfireEvent(ObservableEvent event) protected voidReturns the Set of keys that currently map to the given value.getRealm()protected voidhandleMapChange(MapChangeEvent<? extends K, ? extends V> event) Called whenever a MapChangeEvent is received from the decorated observable.protected booleanprotected voidprotected voidremoveListener(Object listenerType, IObservablesListener listener) Methods inherited from class org.eclipse.core.databinding.observable.map.DecoratingObservableMap
addMapChangeListener, clear, containsKey, entrySet, equals, fireChange, fireMapChange, get, getKeyType, getValueType, hashCode, isEmpty, keySet, put, putAll, remove, removeMapChangeListener, size, toString, valuesMethods inherited from class org.eclipse.core.databinding.observable.DecoratingObservable
getDecorated, getterCalled, handleStaleEvent, isStaleMethods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
BidiObservableMap
Constructs a BidirectionalMap tracking the given observable map.- Parameters:
wrappedMap- the observable map to track
-
-
Method Details
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAddedin classDecoratingObservableMap<K,V>
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemovedin classDecoratingObservableMap<K,V>
-
handleMapChange
Description copied from class:DecoratingObservableMapCalled whenever a MapChangeEvent is received from the decorated observable. By default, this method fires the map change event again, with the decorating observable as the event source. Subclasses may override to provide different behavior.- Overrides:
handleMapChangein classDecoratingObservableMap<K,V> - Parameters:
event- the change event received from the decorated observable
-
containsValue
- Specified by:
containsValuein interfaceIObservableMap<K,V> - Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classDecoratingObservableMap<K,V>
-
getKeys
Returns the Set of keys that currently map to the given value.- Parameters:
value- the value associated with the keys in the returned Set.- Returns:
- the Set of keys that map to the given value. If no keys map to the given value, an empty set is returned.
-
dispose
public void dispose()Description copied from interface:IObservableDisposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
disposein interfaceIObservable- Overrides:
disposein classDecoratingObservableMap<K,V>
-
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
-
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-