com.taco.data
Class WrappedObservableMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by com.taco.data.AbstractNoReturnMap
          extended by com.taco.data.WrappedKeyValueMap
              extended by com.taco.data.WrappedObservableMap
All Implemented Interfaces:
INoReturnMap, INoReturnObservableMap, IObservableMap, java.io.Serializable, java.lang.Cloneable, java.util.Map
Direct Known Subclasses:
DelayedResultObservableMap

public class WrappedObservableMap
extends WrappedKeyValueMap
implements INoReturnObservableMap

A map that wraps keys and values and is also observable.

See Also:
Serialized Form

Nested Class Summary
protected static class WrappedObservableMap.WrappedNotificationStrategy
          A notification strategy that wraps another one, used so that when the observable map notifies its listeners, the keys and values it sends to the listeners are suitably unwrapped (they are stored wrapped in the observable map).
protected  class WrappedObservableMap.WrappedObservableEntry
          Represents a map entry in the entry set.
protected  class WrappedObservableMap.WrappedObservableEntryIterator
           
protected  class WrappedObservableMap.WrappedObservableEntrySet
          A class that acts as the entry set of a WrappedObservableMap.
 
Nested classes/interfaces inherited from class com.taco.data.WrappedKeyValueMap
WrappedKeyValueMap.WrappedEntry, WrappedKeyValueMap.WrappedEntryIterator, WrappedKeyValueMap.WrappedEntrySet
 
Nested classes/interfaces inherited from class com.taco.data.AbstractNoReturnMap
AbstractNoReturnMap.NoReturnEntry, AbstractNoReturnMap.NoReturnEntrySet, AbstractNoReturnMap.NoReturnIterator
 
Nested classes/interfaces inherited from interface com.taco.data.INoReturnObservableMap
INoReturnObservableMap.INoReturnObservableEntry
 
Nested classes/interfaces inherited from interface com.taco.data.INoReturnMap
INoReturnMap.INoReturnEntry
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Nested classes/interfaces inherited from interface com.taco.data.IObservableMap
IObservableMap.IObservableEntry
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Field Summary
protected  INoReturnObservableMap _observableMap
          The observable map this instance decorates.
 
Fields inherited from class com.taco.data.WrappedKeyValueMap
_cachedEntrySet, _innerMap, _keyUnwrapper, _keyWrapper, _noReturnMap, _valueUnwrapper, _valueWrapper
 
Fields inherited from class com.taco.data.AbstractNoReturnMap
_cachedNoReturnEntrySet
 
Fields inherited from interface com.taco.data.IObservableMap
SINGLE_THREADED_STRATEGY
 
Constructor Summary
WrappedObservableMap(IMapFactory mapFactory, int capacity, INotificationStrategy notificationStrategy, IObjectMapper keyWrapper, IObjectMapper keyUnwrapper, IObjectMapper valueWrapper, IObjectMapper valueUnwrapper)
           
WrappedObservableMap(INotificationStrategy notificationStrategy, IObjectMapper keyWrapper, IObjectMapper keyUnwrapper, IObjectMapper valueWrapper, IObjectMapper valueUnwrapper)
           
 
Method Summary
 void addPropertyChangeListener(java.lang.String key, java.beans.PropertyChangeListener listener)
          Add listener to the list of listeners to notify when the value associated with key is changed.
 java.lang.Object clone()
           
 java.util.Set entrySet()
           
 INotificationStrategy getNotificationStrategy()
          Return the unwrapped notification strategy (the same as was passed to the constructor).
 java.util.Collection getPropertyChangeListeners(java.lang.String key)
          Return a copy of the collection of listeners of changes to values associated with the argument key.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Put the key-value pair in the map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value, boolean notifyListeners)
          Put the key-value pair in the map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value, IObjectFilter listenerFilter)
          Put the key-value pair in the map.
 void putAll(java.util.Map source)
          Add mappings of source to this instance using putNoReturn().
 void putAll(java.util.Map source, boolean notifyListeners)
          Copy all of the mappings from the specified map to this map.
 void putAll(java.util.Map source, IObjectFilter listenerFilter)
          Copy all of the mappings from the specified map to this map.
 void putNoReturn(java.lang.Object key, java.lang.Object value)
          This implementation simply calls put() -- there is no speed advantage to using this method.
 void putNoReturn(java.lang.Object key, java.lang.Object value, boolean notifyListeners)
          Associate value with key.
 void putNoReturn(java.lang.Object key, java.lang.Object value, IObjectFilter listenerFilter)
           
 void removePropertyChangeListener(java.lang.String key, java.beans.PropertyChangeListener listener)
          Remove listener from the list of listeners to notify when the value associated with key is changed.
 void setNotificationStrategy(INotificationStrategy strategy)
          Wrap the argument strategy so that listeners are notified with the unwrapped keys and values.
 void setPropertyChangeListeners(java.lang.String key, java.util.Collection listeners)
          Set the collection of listeners to be notified when the value associated with key is changed.
 
Methods inherited from class com.taco.data.WrappedKeyValueMap
clear, entrySetNoReturn, get, isEmpty, remove, removeNoReturn, size
 
Methods inherited from class java.util.AbstractMap
containsKey, containsValue, equals, hashCode, keySet, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.taco.data.INoReturnMap
entrySetNoReturn, removeNoReturn
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, remove, size, values
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, remove, size, values
 

Field Detail

_observableMap

protected INoReturnObservableMap _observableMap
The observable map this instance decorates. This is not final so that it can be set to an independent copy when this instance can be cloned.

Constructor Detail

WrappedObservableMap

public WrappedObservableMap(INotificationStrategy notificationStrategy,
                            IObjectMapper keyWrapper,
                            IObjectMapper keyUnwrapper,
                            IObjectMapper valueWrapper,
                            IObjectMapper valueUnwrapper)

WrappedObservableMap

public WrappedObservableMap(IMapFactory mapFactory,
                            int capacity,
                            INotificationStrategy notificationStrategy,
                            IObjectMapper keyWrapper,
                            IObjectMapper keyUnwrapper,
                            IObjectMapper valueWrapper,
                            IObjectMapper valueUnwrapper)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class WrappedKeyValueMap
Throws:
java.lang.CloneNotSupportedException

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from interface: IObservableMap
Put the key-value pair in the map. Notify all listeners for argument key of the change. This is equivalent to put(key, value, true).

Specified by:
put in interface IObservableMap
Specified by:
put in interface java.util.Map
Overrides:
put in class WrappedKeyValueMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value,
                            boolean notifyListeners)
Description copied from interface: IObservableMap
Put the key-value pair in the map. If notifyListeners is true, notify all listeners for argument key of the change.

Specified by:
put in interface IObservableMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value,
                            IObjectFilter listenerFilter)
Description copied from interface: IObservableMap
Put the key-value pair in the map. Notify all listeners for the argument key that are accepted by the filter of of the change.

Specified by:
put in interface IObservableMap

putNoReturn

public void putNoReturn(java.lang.Object key,
                        java.lang.Object value)
Description copied from class: AbstractNoReturnMap
This implementation simply calls put() -- there is no speed advantage to using this method.

Specified by:
putNoReturn in interface INoReturnMap
Overrides:
putNoReturn in class WrappedKeyValueMap

putNoReturn

public void putNoReturn(java.lang.Object key,
                        java.lang.Object value,
                        boolean notifyListeners)
Description copied from interface: INoReturnObservableMap
Associate value with key. If notifyListeners is true, notify all listeners of the key property.

Specified by:
putNoReturn in interface INoReturnObservableMap

putNoReturn

public void putNoReturn(java.lang.Object key,
                        java.lang.Object value,
                        IObjectFilter listenerFilter)
Specified by:
putNoReturn in interface INoReturnObservableMap

putAll

public void putAll(java.util.Map source)
Description copied from class: AbstractNoReturnMap
Add mappings of source to this instance using putNoReturn().

Specified by:
putAll in interface INoReturnMap
Specified by:
putAll in interface IObservableMap
Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class AbstractNoReturnMap

putAll

public void putAll(java.util.Map source,
                   boolean notifyListeners)
Description copied from interface: IObservableMap
Copy all of the mappings from the specified map to this map. If notifyListeners is true, notify all listeners of the affected keys of the changes.

Specified by:
putAll in interface IObservableMap

putAll

public void putAll(java.util.Map source,
                   IObjectFilter listenerFilter)
Description copied from interface: IObservableMap
Copy all of the mappings from the specified map to this map. If notifyListeners is true, notify all listeners of the affected keys that are accepted by the filter of the changes.

Specified by:
putAll in interface IObservableMap

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Overrides:
entrySet in class WrappedKeyValueMap

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String key,
                                      java.beans.PropertyChangeListener listener)
Description copied from interface: IObservableMap
Add listener to the list of listeners to notify when the value associated with key is changed.

Specified by:
addPropertyChangeListener in interface IObservableMap

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String key,
                                         java.beans.PropertyChangeListener listener)
Description copied from interface: IObservableMap
Remove listener from the list of listeners to notify when the value associated with key is changed. If listener is not on the list, fail silently.

Specified by:
removePropertyChangeListener in interface IObservableMap

getPropertyChangeListeners

public java.util.Collection getPropertyChangeListeners(java.lang.String key)
Description copied from interface: IObservableMap
Return a copy of the collection of listeners of changes to values associated with the argument key. If no listeners are present, return an empty collection.

Specified by:
getPropertyChangeListeners in interface IObservableMap

setPropertyChangeListeners

public void setPropertyChangeListeners(java.lang.String key,
                                       java.util.Collection listeners)
Description copied from interface: IObservableMap
Set the collection of listeners to be notified when the value associated with key is changed. If listeners is null, do not notify any listener. A copy of the argument collection is made so the user is free to modify it afterwards.

Specified by:
setPropertyChangeListeners in interface IObservableMap

getNotificationStrategy

public INotificationStrategy getNotificationStrategy()
Return the unwrapped notification strategy (the same as was passed to the constructor).

Specified by:
getNotificationStrategy in interface IObservableMap

setNotificationStrategy

public void setNotificationStrategy(INotificationStrategy strategy)
Wrap the argument strategy so that listeners are notified with the unwrapped keys and values.

Specified by:
setNotificationStrategy in interface IObservableMap