Class CompositeMap<K,I,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.CompositeMap<K,I,V>
- Type Parameters:
K- the type of the keys in this mapI- the type of the intermediate valuesV- the type of the values in this map
- All Implemented Interfaces:
Map<K,,V> IObservable,IObservableMap<K,V>
A read-only observable map formed by the composition of two observable maps.
If map1 maps keys a:A to values b1:B, and map2 maps keys b2:B to values c:C,
the composite map maps keys a:A to values c:C. For example, map1 could map
Order objects to their corresponding Customer objects, and map2 could map
Customer objects to their "last name" property of type String. The composite
map of map1 and map2 would then map Order objects to their customers' last
names.
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.1
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.eclipse.core.databinding.observable.map.ObservableMap
wrappedMap -
Constructor Summary
ConstructorsConstructorDescriptionCompositeMap(IObservableMap<K, I> firstMap, IObservableFactory<? super IObservableSet<I>, ? extends IObservableMap<I, V>> secondMapFactory) Creates a new composite map. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListener(Object listenerType, IObservablesListener listener) protected Objectclone()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 element type for thekeysetof this observable map, ornullif the keyset is untyped.getRealm()Returns the element type for thevaluesof this observable map, ornullif the values collection is untyped.protected booleanprotected voidprotected voidremoveListener(Object listenerType, IObservablesListener listener) Methods inherited from class org.eclipse.core.databinding.observable.map.ObservableMap
addMapChangeListener, clear, containsKey, containsValue, entrySet, equals, fireMapChange, get, getterCalled, hashCode, isEmpty, isStale, keySet, put, putAll, remove, removeMapChangeListener, setStale, size, valuesMethods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireChange, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
CompositeMap
public CompositeMap(IObservableMap<K, I> firstMap, IObservableFactory<? super IObservableSet<I>, ? extends IObservableMap<I, V>> secondMapFactory) Creates a new composite map. Because the key set of the second map is determined by the value set of the given observable mapfirstMap, it cannot be passed in as an argument. Instead, the second map will be created by callingsecondMapFactory.createObservable(valueSet()).- Parameters:
firstMap- the first mapsecondMapFactory- a factory that creates the second map when given an observable set representing the value set offirstMap.
-
-
Method Details
-
getKeyType
Description copied from interface:IObservableMapReturns the element type for thekeysetof this observable map, ornullif the keyset is untyped.- Specified by:
getKeyTypein interfaceIObservableMap<K,I> - Overrides:
getKeyTypein classObservableMap<K,V> - Returns:
- the element type for the
keysetof this observable map, ornullif the keyset is untyped. - Since:
- 1.2
-
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,I> - Overrides:
getValueTypein classObservableMap<K,V> - Returns:
- the element type for the
valuesof this observable map, ornullif the values collection is untyped. - Since:
- 1.2
-
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 classAbstractObservable
-
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:
clonein classObject- Throws:
CloneNotSupportedException
-