Class ComputedObservableMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.eclipse.core.databinding.observable.map.AbstractObservableMap<K,V>
-
- org.eclipse.core.databinding.observable.map.ComputedObservableMap<K,V>
-
- Type Parameters:
K- type of the keys to the mapV- type of the values in the map
- All Implemented Interfaces:
Map<K,V>,IObservable,IObservableMap<K,V>
public abstract class ComputedObservableMap<K,V> extends AbstractObservableMap<K,V>
Maps objects to one of their attributes. Tracks changes to the underlying observable set of objects (keys), as well as changes to attribute values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description ComputedObservableMap(IObservableSet<K> keySet)ComputedObservableMap(IObservableSet<K> keySet, Object valueType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancontainsKey(Object key)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 abstract VdoGet(K key)protected abstract VdoPut(K key, V value)Set<Map.Entry<K,V>>entrySet()protected voidfireSingleChange(K key, V oldValue, V newValue)protected voidfirstListenerAdded()Vget(Object key)ObjectgetKeyType()Returns the element type for thekeysetof this observable map, ornullif the keyset is untyped.ObjectgetValueType()Returns the element type for thevaluesof this observable map, ornullif the values collection is untyped.protected abstract voidhookListener(K addedKey)protected voidinit()Deprecated.Subclasses are no longer required to call this method.booleanisStale()Returns whether the state of this observable is stale and is expected to change soon.Set<K>keySet()protected voidlastListenerRemoved()Vput(K key, V value)Vremove(Object key)protected abstract voidunhookListener(K removedKey)-
Methods inherited from class org.eclipse.core.databinding.observable.map.AbstractObservableMap
addChangeListener, addDisposeListener, addMapChangeListener, addStaleListener, checkRealm, fireChange, fireMapChange, fireStale, getRealm, hasListeners, isDisposed, removeChangeListener, removeDisposeListener, removeMapChangeListener, removeStaleListener, setStale
-
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, putAll, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.core.databinding.observable.map.IObservableMap
containsValue, equals, hashCode, isEmpty, size, values
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
ComputedObservableMap
public ComputedObservableMap(IObservableSet<K> keySet)
- Parameters:
keySet-
-
ComputedObservableMap
public ComputedObservableMap(IObservableSet<K> keySet, Object valueType)
- Parameters:
keySet-valueType-- Since:
- 1.2
-
-
Method Detail
-
init
@Deprecated protected void init()
Deprecated.Subclasses are no longer required to call this method.
-
firstListenerAdded
protected void firstListenerAdded()
- Overrides:
firstListenerAddedin classAbstractObservableMap<K,V>
-
lastListenerRemoved
protected void lastListenerRemoved()
- Overrides:
lastListenerRemovedin classAbstractObservableMap<K,V>
-
getKeyType
public Object 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>- Overrides:
getKeyTypein classAbstractObservableMap<K,V>- Returns:
- the element type for the
keysetof this observable map, ornullif the keyset is untyped. - Since:
- 1.2
-
getValueType
public Object 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>- Overrides:
getValueTypein classAbstractObservableMap<K,V>- Returns:
- the element type for the
valuesof this observable map, ornullif the values collection is untyped. - Since:
- 1.2
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceIObservableMap<K,V>- Specified by:
containsKeyin interfaceMap<K,V>- Overrides:
containsKeyin classAbstractMap<K,V>- Since:
- 1.3
-
unhookListener
protected abstract void unhookListener(K removedKey)
- Parameters:
removedKey-
-
hookListener
protected abstract void hookListener(K addedKey)
- Parameters:
addedKey-
-
doPut
protected abstract V doPut(K key, V value)
- Parameters:
key-value-- Returns:
- the old value for the given key
-
isStale
public boolean isStale()
Description copied from interface:IObservableReturns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.- Specified by:
isStalein interfaceIObservable- Overrides:
isStalein classAbstractObservableMap<K,V>- Returns:
- true if this observable's state is stale and will change soon.
-
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 classAbstractObservableMap<K,V>
-
-