helma.util
Class CopyOnWriteMap

java.lang.Object
  extended by helma.util.WrappedMap
      extended by helma.util.CopyOnWriteMap
All Implemented Interfaces:
java.util.Map

public class CopyOnWriteMap
extends WrappedMap

A Map that wraps another map and creates a new copy of the wrapped map if we try to modify it. This class is wrapped as a native scripted object in JavaScript rather than exposing them through Java reflection. All methods in this class are synchronized in order not to miss the switch between original and copied map.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class helma.util.WrappedMap
readonly, wrapped
 
Constructor Summary
CopyOnWriteMap(java.util.Map map)
          Constructor
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(java.lang.Object key)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object remove(java.lang.Object key)
           
 int size()
           
 java.lang.String toString()
           
 java.util.Collection values()
           
 boolean wasModified()
           
 
Methods inherited from class helma.util.WrappedMap
isReadonly, setReadonly
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CopyOnWriteMap

public CopyOnWriteMap(java.util.Map map)
Constructor

Method Detail

wasModified

public boolean wasModified()

size

public int size()
Specified by:
size in interface java.util.Map
Overrides:
size in class WrappedMap

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
Overrides:
isEmpty in class WrappedMap

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class WrappedMap

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map
Overrides:
containsValue in class WrappedMap

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
Overrides:
get in class WrappedMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
Overrides:
put in class WrappedMap

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
Overrides:
remove in class WrappedMap

putAll

public void putAll(java.util.Map t)
Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class WrappedMap

clear

public void clear()
Specified by:
clear in interface java.util.Map
Overrides:
clear in class WrappedMap

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
Overrides:
keySet in class WrappedMap

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map
Overrides:
values in class WrappedMap

entrySet

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

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map
Overrides:
equals in class WrappedMap

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class WrappedMap

toString

public java.lang.String toString()
Overrides:
toString in class WrappedMap


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.