org.dishevelled.observable.impl
Class ObservableMapImpl<K,V>

java.lang.Object
  extended by org.dishevelled.observable.AbstractMapDecorator<K,V>
      extended by org.dishevelled.observable.AbstractObservableMap<K,V>
          extended by org.dishevelled.observable.impl.ObservableMapImpl<K,V>
Type Parameters:
K - map key type
V - map value type
All Implemented Interfaces:
Map<K,V>, ObservableMap<K,V>

public class ObservableMapImpl<K,V>
extends AbstractObservableMap<K,V>

Observable map decorator that fires empty vetoable map change events in preXxx methods and empty map change events in postXxx methods. Observable map listeners may query the source of the events to determine what may or may not have changed due to the event.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dishevelled.observable.AbstractObservableMap
AbstractObservableMap.ObservableEntrySet, AbstractObservableMap.ObservableKeySet, AbstractObservableMap.ObservableValues
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ObservableMapImpl(Map<K,V> map)
          Create a new observable decorator for the specified map.
 
Method Summary
protected  void postClear()
          Notify subclasses the clear method has just been called on the wrapped map.
protected  void postEntrySetClear()
          Notify subclasses the clear method has just been called on the entrySet view for the wrapped map with the specified parameter.
protected  void postEntrySetIteratorRemove()
          Notify subclasses the remove method has just been called on the entrySet view iterator for the wrapped map.
protected  void postEntrySetRemove(Object value)
          Notify subclasses the remove method has just been called on the entrySet view for the wrapped map with the specified parameter.
protected  void postEntrySetRemoveAll(Collection<?> entrySet)
          Notify subclasses the removeAll method has just been called on the entrySet view for the wrapped map with the specified parameter.
protected  void postEntrySetRetainAll(Collection<?> entrySet)
          Notify subclasses the clear method has just been called on the entrySet view for the wrapped map with the specified parameter.
protected  void postKeySetClear()
          Notify subclasses the clear method has just been called on the keySet view for the wrapped map with the specified parameter.
protected  void postKeySetIteratorRemove()
          Notify subclasses the remove method has just been called on the keySet view iterator for the wrapped map.
protected  void postKeySetRemove(Object value)
          Notify subclasses the remove method has just been called on the keySet view for the wrapped map with the specified parameter.
protected  void postKeySetRemoveAll(Collection<?> keySet)
          Notify subclasses the removeAll method has just been called on the keySet view for the wrapped map with the specified parameter.
protected  void postKeySetRetainAll(Collection<?> keySet)
          Notify subclasses the clear method has just been called on the keySet view for the wrapped map with the specified parameter.
protected  void postMapEntrySetValue(V value)
          Notify subclasses the setValue method has just been called on a map entry from the entrySet view iterator for the wrapped map.
protected  void postPut(K key, V value)
          Notify subclasses the put method has just been called on the wrapped map with the specified parameters.
protected  void postPutAll(Map<? extends K,? extends V> map)
          Notify subclasses the putAll method has just been called on the wrapped map with the specified parameter.
protected  void postRemove(Object key)
          Notify subclasses the remove method has just been called on the wrapped map with the specified parameter.
protected  void postValuesClear()
          Notify subclasses the clear method has just been called on the values view for the wrapped map with the specified parameter.
protected  void postValuesIteratorRemove()
          Notify subclasses the remove method has just been called on the values view iterator for the wrapped map.
protected  void postValuesRemove(Object value)
          Notify subclasses the remove method has just been called on the values view for the wrapped map with the specified parameter.
protected  void postValuesRemoveAll(Collection<?> values)
          Notify subclasses the removeAll method has just been called on the values view for the wrapped map with the specified parameter.
protected  void postValuesRetainAll(Collection<?> values)
          Notify subclasses the clear method has just been called on the values view for the wrapped map with the specified parameter.
protected  boolean preClear()
          Notify subclasses the clear method is about to be called on the wrapped map.
protected  boolean preEntrySetClear()
          Notify subclasses the clear method is about to be called on the entrySet view for the wrapped map.
protected  boolean preEntrySetIteratorRemove()
          Notify subclasses the remove method is about to be called on the entrySet view iterator for the wrapped map.
protected  boolean preEntrySetRemove(Object value)
          Notify subclasses the remove method is about to be called on the entrySet view for the wrapped map.
protected  boolean preEntrySetRemoveAll(Collection<?> entrySet)
          Notify subclasses the removeAll method is about to be called on the entrySet view for the wrapped map.
protected  boolean preEntrySetRetainAll(Collection<?> entrySet)
          Notify subclasses the retainAll method is about to be called on the entrySet view for the wrapped map.
protected  boolean preKeySetClear()
          Notify subclasses the clear method is about to be called on the keySet view for the wrapped map.
protected  boolean preKeySetIteratorRemove()
          Notify subclasses the remove method is about to be called on the keySet view iterator for the wrapped map.
protected  boolean preKeySetRemove(Object value)
          Notify subclasses the remove method is about to be called on the keySet view for the wrapped map.
protected  boolean preKeySetRemoveAll(Collection<?> keySet)
          Notify subclasses the removeAll method is about to be called on the keySet view for the wrapped map.
protected  boolean preKeySetRetainAll(Collection<?> keySet)
          Notify subclasses the retainAll method is about to be called on the keySet view for the wrapped map.
protected  boolean preMapEntrySetValue(V value)
          Notify subclasses the setValue method is about to be called on a map entry from the entrySet view iterator for the wrapped map.
protected  boolean prePut(K key, V value)
          Notify subclasses the put method is about to be called on the wrapped map with the specified parameters.
protected  boolean prePutAll(Map<? extends K,? extends V> map)
          Notify subclasses the putAll method is about to be called on the wrapped map with the specified parameter.
protected  boolean preRemove(Object key)
          Notify subclasses the remove method is about to be called on the wrapped map with the specified parameter.
protected  boolean preValuesClear()
          Notify subclasses the clear method is about to be called on the values view for the wrapped map.
protected  boolean preValuesIteratorRemove()
          Notify subclasses the remove method is about to be called on the values view iterator for the wrapped map.
protected  boolean preValuesRemove(Object value)
          Notify subclasses the remove method is about to be called on the values view for the wrapped map.
protected  boolean preValuesRemoveAll(Collection<?> values)
          Notify subclasses the removeAll method is about to be called on the values view for the wrapped map.
protected  boolean preValuesRetainAll(Collection<?> values)
          Notify subclasses the retainAll method is about to be called on the values view for the wrapped map.
 
Methods inherited from class org.dishevelled.observable.AbstractObservableMap
addMapChangeListener, addVetoableMapChangeListener, clear, entrySet, fireMapChanged, fireMapChanged, fireMapWillChange, fireMapWillChange, getMapChangeListenerCount, getMapChangeListeners, getObservableMapChangeSupport, getVetoableMapChangeListenerCount, getVetoableMapChangeListeners, keySet, put, putAll, remove, removeMapChangeListener, removeVetoableMapChangeListener, values
 
Methods inherited from class org.dishevelled.observable.AbstractMapDecorator
containsKey, containsValue, equals, get, getMap, hashCode, isEmpty, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, containsValue, equals, get, hashCode, isEmpty, size
 

Constructor Detail

ObservableMapImpl

public ObservableMapImpl(Map<K,V> map)
Create a new observable decorator for the specified map.

Parameters:
map - map to decorate, must not be null
Method Detail

preClear

protected boolean preClear()
Notify subclasses the clear method is about to be called on the wrapped map. Return true to proceed with the change.

Specified by:
preClear in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postClear

protected void postClear()
Notify subclasses the clear method has just been called on the wrapped map.

Specified by:
postClear in class AbstractObservableMap<K,V>

prePut

protected boolean prePut(K key,
                         V value)
Notify subclasses the put method is about to be called on the wrapped map with the specified parameters. Return true to proceed with the change.

Specified by:
prePut in class AbstractObservableMap<K,V>
Parameters:
key - put method key parameter
value - put method value parameter
Returns:
true to proceed with the change

postPut

protected void postPut(K key,
                       V value)
Notify subclasses the put method has just been called on the wrapped map with the specified parameters.

Specified by:
postPut in class AbstractObservableMap<K,V>
Parameters:
key - put method key parameter
value - put method value parameter

prePutAll

protected boolean prePutAll(Map<? extends K,? extends V> map)
Notify subclasses the putAll method is about to be called on the wrapped map with the specified parameter. Return true to proceed with the change.

Specified by:
prePutAll in class AbstractObservableMap<K,V>
Parameters:
map - putAll method parameter
Returns:
true to proceed with the change

postPutAll

protected void postPutAll(Map<? extends K,? extends V> map)
Notify subclasses the putAll method has just been called on the wrapped map with the specified parameter.

Specified by:
postPutAll in class AbstractObservableMap<K,V>
Parameters:
map - putAll method parameter

preRemove

protected boolean preRemove(Object key)
Notify subclasses the remove method is about to be called on the wrapped map with the specified parameter. Return true to proceed with the change.

Specified by:
preRemove in class AbstractObservableMap<K,V>
Parameters:
key - remove method parameter
Returns:
true to proceed with the change

postRemove

protected void postRemove(Object key)
Notify subclasses the remove method has just been called on the wrapped map with the specified parameter.

Specified by:
postRemove in class AbstractObservableMap<K,V>
Parameters:
key - remove method parameter

preValuesClear

protected boolean preValuesClear()
Notify subclasses the clear method is about to be called on the values view for the wrapped map. Return true to proceed with the change.

Specified by:
preValuesClear in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postValuesClear

protected void postValuesClear()
Notify subclasses the clear method has just been called on the values view for the wrapped map with the specified parameter.

Specified by:
postValuesClear in class AbstractObservableMap<K,V>

preValuesRemove

protected boolean preValuesRemove(Object value)
Notify subclasses the remove method is about to be called on the values view for the wrapped map. Return true to proceed with the change.

Specified by:
preValuesRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter
Returns:
true to proceed with the change

postValuesRemove

protected void postValuesRemove(Object value)
Notify subclasses the remove method has just been called on the values view for the wrapped map with the specified parameter.

Specified by:
postValuesRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter

preValuesRemoveAll

protected boolean preValuesRemoveAll(Collection<?> values)
Notify subclasses the removeAll method is about to be called on the values view for the wrapped map. Return true to proceed with the change.

Specified by:
preValuesRemoveAll in class AbstractObservableMap<K,V>
Parameters:
values - removeAll method parameter
Returns:
true to proceed with the change

postValuesRemoveAll

protected void postValuesRemoveAll(Collection<?> values)
Notify subclasses the removeAll method has just been called on the values view for the wrapped map with the specified parameter.

Specified by:
postValuesRemoveAll in class AbstractObservableMap<K,V>
Parameters:
values - removeAll method parameter

preValuesRetainAll

protected boolean preValuesRetainAll(Collection<?> values)
Notify subclasses the retainAll method is about to be called on the values view for the wrapped map. Return true to proceed with the change.

Specified by:
preValuesRetainAll in class AbstractObservableMap<K,V>
Parameters:
values - retainAll method parameter
Returns:
true to proceed with the change

postValuesRetainAll

protected void postValuesRetainAll(Collection<?> values)
Notify subclasses the clear method has just been called on the values view for the wrapped map with the specified parameter.

Specified by:
postValuesRetainAll in class AbstractObservableMap<K,V>
Parameters:
values - retainAll method parameter

preValuesIteratorRemove

protected boolean preValuesIteratorRemove()
Notify subclasses the remove method is about to be called on the values view iterator for the wrapped map. Return true to proceed with the change.

Specified by:
preValuesIteratorRemove in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postValuesIteratorRemove

protected void postValuesIteratorRemove()
Notify subclasses the remove method has just been called on the values view iterator for the wrapped map.

Specified by:
postValuesIteratorRemove in class AbstractObservableMap<K,V>

preKeySetClear

protected boolean preKeySetClear()
Notify subclasses the clear method is about to be called on the keySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preKeySetClear in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postKeySetClear

protected void postKeySetClear()
Notify subclasses the clear method has just been called on the keySet view for the wrapped map with the specified parameter.

Specified by:
postKeySetClear in class AbstractObservableMap<K,V>

preKeySetRemove

protected boolean preKeySetRemove(Object value)
Notify subclasses the remove method is about to be called on the keySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preKeySetRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter
Returns:
true to proceed with the change

postKeySetRemove

protected void postKeySetRemove(Object value)
Notify subclasses the remove method has just been called on the keySet view for the wrapped map with the specified parameter.

Specified by:
postKeySetRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter

preKeySetRemoveAll

protected boolean preKeySetRemoveAll(Collection<?> keySet)
Notify subclasses the removeAll method is about to be called on the keySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preKeySetRemoveAll in class AbstractObservableMap<K,V>
Parameters:
keySet - removeAll method parameter
Returns:
true to proceed with the change

postKeySetRemoveAll

protected void postKeySetRemoveAll(Collection<?> keySet)
Notify subclasses the removeAll method has just been called on the keySet view for the wrapped map with the specified parameter.

Specified by:
postKeySetRemoveAll in class AbstractObservableMap<K,V>
Parameters:
keySet - removeAll method parameter

preKeySetRetainAll

protected boolean preKeySetRetainAll(Collection<?> keySet)
Notify subclasses the retainAll method is about to be called on the keySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preKeySetRetainAll in class AbstractObservableMap<K,V>
Parameters:
keySet - retainAll method parameter
Returns:
true to proceed with the change

postKeySetRetainAll

protected void postKeySetRetainAll(Collection<?> keySet)
Notify subclasses the clear method has just been called on the keySet view for the wrapped map with the specified parameter.

Specified by:
postKeySetRetainAll in class AbstractObservableMap<K,V>
Parameters:
keySet - retainAll method parameter

preKeySetIteratorRemove

protected boolean preKeySetIteratorRemove()
Notify subclasses the remove method is about to be called on the keySet view iterator for the wrapped map. Return true to proceed with the change.

Specified by:
preKeySetIteratorRemove in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postKeySetIteratorRemove

protected void postKeySetIteratorRemove()
Notify subclasses the remove method has just been called on the keySet view iterator for the wrapped map.

Specified by:
postKeySetIteratorRemove in class AbstractObservableMap<K,V>

preEntrySetClear

protected boolean preEntrySetClear()
Notify subclasses the clear method is about to be called on the entrySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preEntrySetClear in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postEntrySetClear

protected void postEntrySetClear()
Notify subclasses the clear method has just been called on the entrySet view for the wrapped map with the specified parameter.

Specified by:
postEntrySetClear in class AbstractObservableMap<K,V>

preEntrySetRemove

protected boolean preEntrySetRemove(Object value)
Notify subclasses the remove method is about to be called on the entrySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preEntrySetRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter
Returns:
true to proceed with the change

postEntrySetRemove

protected void postEntrySetRemove(Object value)
Notify subclasses the remove method has just been called on the entrySet view for the wrapped map with the specified parameter.

Specified by:
postEntrySetRemove in class AbstractObservableMap<K,V>
Parameters:
value - remove method parameter

preEntrySetRemoveAll

protected boolean preEntrySetRemoveAll(Collection<?> entrySet)
Notify subclasses the removeAll method is about to be called on the entrySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preEntrySetRemoveAll in class AbstractObservableMap<K,V>
Parameters:
entrySet - removeAll method parameter
Returns:
true to proceed with the change

postEntrySetRemoveAll

protected void postEntrySetRemoveAll(Collection<?> entrySet)
Notify subclasses the removeAll method has just been called on the entrySet view for the wrapped map with the specified parameter.

Specified by:
postEntrySetRemoveAll in class AbstractObservableMap<K,V>
Parameters:
entrySet - removeAll method parameter

preEntrySetRetainAll

protected boolean preEntrySetRetainAll(Collection<?> entrySet)
Notify subclasses the retainAll method is about to be called on the entrySet view for the wrapped map. Return true to proceed with the change.

Specified by:
preEntrySetRetainAll in class AbstractObservableMap<K,V>
Parameters:
entrySet - retainAll method parameter
Returns:
true to proceed with the change

postEntrySetRetainAll

protected void postEntrySetRetainAll(Collection<?> entrySet)
Notify subclasses the clear method has just been called on the entrySet view for the wrapped map with the specified parameter.

Specified by:
postEntrySetRetainAll in class AbstractObservableMap<K,V>
Parameters:
entrySet - retainAll method parameter

preEntrySetIteratorRemove

protected boolean preEntrySetIteratorRemove()
Notify subclasses the remove method is about to be called on the entrySet view iterator for the wrapped map. Return true to proceed with the change.

Specified by:
preEntrySetIteratorRemove in class AbstractObservableMap<K,V>
Returns:
true to proceed with the change

postEntrySetIteratorRemove

protected void postEntrySetIteratorRemove()
Notify subclasses the remove method has just been called on the entrySet view iterator for the wrapped map.

Specified by:
postEntrySetIteratorRemove in class AbstractObservableMap<K,V>

preMapEntrySetValue

protected boolean preMapEntrySetValue(V value)
Notify subclasses the setValue method is about to be called on a map entry from the entrySet view iterator for the wrapped map. Return true to proceed with the change.

Specified by:
preMapEntrySetValue in class AbstractObservableMap<K,V>
Parameters:
value - setValue method parameter
Returns:
true to proceed with the change

postMapEntrySetValue

protected void postMapEntrySetValue(V value)
Notify subclasses the setValue method has just been called on a map entry from the entrySet view iterator for the wrapped map.

Specified by:
postMapEntrySetValue in class AbstractObservableMap<K,V>
Parameters:
value - setValue method parameter


Copyright (c) 2003-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).