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

# Class DecoratingObservableMap<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>

Type Parameters:
  `K` - type of the keys to the map
  `V` - type of the values in the map

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

Direct Known Subclasses:
  `BidiObservableMap`

public class DecoratingObservableMap<K,V> extends DecoratingObservable implements IObservableMap<K,V>
An observable map which decorates another observable map.

Since:
  1.2
Implementation Note:
  If methods are added to the interface which this class implements then implementations of those methods must be added to this class.

## Nested Class Summary

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

`Map.Entry<K,V>`

## Constructor Summary

Constructors
Constructor
Description
`DecoratingObservableMap(IObservableMap<K,V> decorated, boolean disposeDecoratedOnDispose)`
Constructs a DecoratingObservableMap which decorates the given observable.

## Method Summary

Modifier and Type
Method
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 obj)`
`protected void`
`fireChange()`
`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()`
`Object`
`getValueType()`
Returns the element type for the `values` of this observable map, or `null` if the values collection is untyped.
`protected void`
`handleMapChange(MapChangeEvent<? extends K,? extends V> event)`
Called whenever a MapChangeEvent is received from the decorated observable.
`int`
`hashCode()`
`protected boolean`
`hasListeners()`
`boolean`
`isEmpty()`
`Set<K>`
`keySet()`
`protected void`
`lastListenerRemoved()`
`V`
`put(K key, V value)`
`void`
`putAll(Map<? extends K,? extends V> m)`
`V`
`remove(Object key)`
`protected void`
`removeListener(Object listenerType, IObservablesListener listener)`
`void`
`removeMapChangeListener(IMapChangeListener<? super K,? super V> listener)`
`int`
`size()`
`String`
`toString()`
`Collection<V>`
`values()`

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

`getDecorated, getterCalled, handleStaleEvent, isStale`

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

`addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.core.databinding.observable.IObservable

`addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListener`

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

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

## Constructor Details

### DecoratingObservableMap

public DecoratingObservableMap(IObservableMap<K,V> decorated, boolean disposeDecoratedOnDispose)
Constructs a DecoratingObservableMap which decorates the given observable.

Parameters:
  `decorated` - the observable map being decorated
  `disposeDecoratedOnDispose` - whether the decorated observable should be disposed when the decorator is disposed

## Method Details

### addMapChangeListener

public void addMapChangeListener(IMapChangeListener<? super K,? super V> listener)

Specified by:
  `addMapChangeListener` in interface `IObservableMap<K,V>`
Parameters:
  `listener` - the change listener to add; not `null`

### removeMapChangeListener

public void removeMapChangeListener(IMapChangeListener<? super K,? super V> listener)

Specified by:
  `removeMapChangeListener` in interface `IObservableMap<K,V>`
Parameters:
  `listener` - the change listener to remove; not `null`

### 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,V>`
Returns:
  the element type for the `keyset` of this observable map, or `null` if the keyset is untyped.

### 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,V>`
Returns:
  the element type for the `values` of this observable map, or `null` if the values collection is untyped.

### fireMapChange

protected void fireMapChange(MapDiff<K,V> diff)

### fireChange

protected void fireChange()

Overrides:
  `fireChange` in class `AbstractObservable`

### firstListenerAdded

protected void firstListenerAdded()

Overrides:
  `firstListenerAdded` in class `DecoratingObservable`

### lastListenerRemoved

protected void lastListenerRemoved()

Overrides:
  `lastListenerRemoved` in class `DecoratingObservable`

### handleMapChange

protected void handleMapChange(MapChangeEvent<? extends K,? extends V> event)
Called 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.

Parameters:
  `event` - the change event received from the decorated observable

### clear

public void clear()

Specified by:
  `clear` in interface `Map<K,V>`

### containsKey

public boolean containsKey(Object key)

Specified by:
  `containsKey` in interface `IObservableMap<K,V>`
Specified by:
  `containsKey` in interface `Map<K,V>`

### containsValue

public boolean containsValue(Object value)

Specified by:
  `containsValue` in interface `IObservableMap<K,V>`
Specified by:
  `containsValue` in interface `Map<K,V>`

### entrySet

public Set<Map.Entry<K,V>> entrySet()

Specified by:
  `entrySet` in interface `IObservableMap<K,V>`
Specified by:
  `entrySet` in interface `Map<K,V>`

### get

public V get(Object key)

Specified by:
  `get` in interface `IObservableMap<K,V>`
Specified by:
  `get` in interface `Map<K,V>`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `IObservableMap<K,V>`
Specified by:
  `isEmpty` in interface `Map<K,V>`

### keySet

public Set<K> keySet()

Specified by:
  `keySet` in interface `IObservableMap<K,V>`
Specified by:
  `keySet` in interface `Map<K,V>`

### put

public V put(K key, V value)

Specified by:
  `put` in interface `IObservableMap<K,V>`
Specified by:
  `put` in interface `Map<K,V>`

### putAll

public void putAll(Map<? extends K,? extends V> m)

Specified by:
  `putAll` in interface `Map<K,V>`

### remove

public V remove(Object key)

Specified by:
  `remove` in interface `IObservableMap<K,V>`
Specified by:
  `remove` in interface `Map<K,V>`

### size

public int size()

Specified by:
  `size` in interface `IObservableMap<K,V>`
Specified by:
  `size` in interface `Map<K,V>`

### values

public Collection<V> values()

Specified by:
  `values` in interface `IObservableMap<K,V>`
Specified by:
  `values` in interface `Map<K,V>`

### equals

public boolean equals(Object obj)

Specified by:
  `equals` in interface `IObservableMap<K,V>`
Specified by:
  `equals` in interface `Map<K,V>`
Overrides:
  `equals` in class `DecoratingObservable`

### hashCode

public int hashCode()

Specified by:
  `hashCode` in interface `IObservableMap<K,V>`
Specified by:
  `hashCode` in interface `Map<K,V>`
Overrides:
  `hashCode` in class `DecoratingObservable`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### 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 `DecoratingObservable`

### addListener

protected void addListener(Object listenerType, IObservablesListener listener)

Parameters:
  `listenerType` - arbitrary object to identify a type of the listener
  `listener` - the listener to add; not `null`

### removeListener

protected void removeListener(Object listenerType, IObservablesListener listener)

Parameters:
  `listenerType` - arbitrary object to identify a type of the listener
  `listener` - the listener to remove; not `null`

### hasListeners

protected boolean hasListeners()

### fireEvent

protected void fireEvent(ObservableEvent event)

### getRealm

public Realm getRealm()

Returns:
  Returns the realm.

### clone

protected Object clone() throws CloneNotSupportedException

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