Package org.eclipse.core.databinding.observable.map

## 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 map
  `I` - the type of the intermediate values
  `V` - the type of the values in this map

All Implemented Interfaces:
  `Map<K,​V>`, `IObservable`, `IObservableMap<K,​V>`

    public class CompositeMap<K,​I,​V>
    extends ObservableMap<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

### Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,​V extends Object>`

### Field Summary

### Fields inherited from class org.eclipse.core.databinding.observable.map.ObservableMap

`wrappedMap`

### Constructor Summary

Constructors
`CompositeMap​(IObservableMap<K,​I> firstMap, IObservableFactory<Set<I>,​IObservableMap<I,​V>> secondMapFactory)` Creates a new composite map.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `addListener​(Object listenerType, IObservablesListener listener)`
`protected Object` `clone()`
`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.
`protected void` `fireEvent​(ObservableEvent event)`
`protected void` `firstListenerAdded()`
`Object` `getKeyType()` Returns the element type for the `keyset` of this observable map, or `null` if the keyset is untyped.
`Realm` `getRealm()`
`Object` `getValueType()` Returns the element type for the `values` of this observable map, or `null` if the values collection is untyped.
`protected boolean` `hasListeners()`
`protected void` `lastListenerRemoved()`
`protected void` `removeListener​(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, values`

### Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable

`addChangeListener, addDisposeListener, addStaleListener, checkRealm, 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, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

### Constructor Detail

#### CompositeMap

    public CompositeMap​(IObservableMap<K,​I> firstMap,
                        IObservableFactory<Set<I>,​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 map `firstMap`, it cannot be passed in as an argument. Instead, the second map will be created by calling `secondMapFactory.createObservable(valueSet())`.

Parameters:
  `firstMap` - the first map
  `secondMapFactory` - a factory that creates the second map when given an observable set representing the value set of `firstMap`.

### Method Detail

#### getKeyType

    public Object getKeyType()

Description copied from interface: `IObservableMap`
Returns the element type for the `keyset` of this observable map, or `null` if the keyset is untyped.

Specified by:
  `getKeyType` in interface `IObservableMap<K,​I>`
Overrides:
  `getKeyType` in class `ObservableMap<K,​V>`
Returns:
  the element type for the `keyset` of this observable map, or `null` if the keyset is untyped.
Since:
  1.2

#### getValueType

    public Object getValueType()

Description copied from interface: `IObservableMap`
Returns the element type for the `values` of this observable map, or `null` if the values collection is untyped.

Specified by:
  `getValueType` in interface `IObservableMap<K,​I>`
Overrides:
  `getValueType` in class `ObservableMap<K,​V>`
Returns:
  the element type for the `values` of this observable map, or `null` if the values collection is untyped.
Since:
  1.2

#### dispose

    public void dispose()

Description copied from interface: `IObservable`
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.

Specified by:
  `dispose` in interface `IObservable`
Overrides:
  `dispose` in class `ObservableMap<K,​V>`

#### addListener

    protected void addListener​(Object listenerType,
                               IObservablesListener listener)

Parameters:
  `listenerType` -
  `listener` -

#### removeListener

    protected void removeListener​(Object listenerType,
                                  IObservablesListener listener)

Parameters:
  `listenerType` -
  `listener` -

#### hasListeners

    protected boolean hasListeners()

#### fireEvent

    protected void fireEvent​(ObservableEvent event)

#### firstListenerAdded

    protected void firstListenerAdded()

#### lastListenerRemoved

    protected void lastListenerRemoved()

#### getRealm

    public Realm getRealm()

Returns:
  Returns the realm.

#### clone

    protected Object clone()
                    throws CloneNotSupportedException

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`