Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.common.collections
Class ScopedMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Serializable>
          extended by org.nuxeo.common.collections.ScopedMap
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Serializable>

public class ScopedMap
extends HashMap<String,Serializable>

Scoped map holding data for a given scope.

Used to store context data and invalidate some data given its scope. Implements Map for easier use from interface.

Author:
Anahide Tchertchian
See Also:
ScopeType, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
ScopedMap()
           
 
Method Summary
 void clearScope(ScopeType scopeType)
          Removes all mappings for given scope.
 Map<String,Serializable> getDefaultScopeValues()
          Creates a Map with entries from DEFAULT scope.
 Serializable getScopedValue(ScopeType scope, String key)
          Gets value for given scope and given key.
 Serializable getScopedValue(String key)
          Gets value for given key using default scope.
 Map<String,Serializable> getScopeValues(ScopeType scopeType)
          Creates a Map with entries from specified scope.
 void putScopedValue(ScopeType scope, String key, Serializable value)
          Sets value for given scope and given key.
 void putScopedValue(String key, Serializable value)
          Sets key using default scope.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ScopedMap

public ScopedMap()
Method Detail

getScopedValue

public Serializable getScopedValue(ScopeType scope,
                                   String key)
Gets value for given scope and given key.


getScopedValue

public Serializable getScopedValue(String key)
Gets value for given key using default scope.


getDefaultScopeValues

public Map<String,Serializable> getDefaultScopeValues()
Creates a Map with entries from DEFAULT scope.


getScopeValues

public Map<String,Serializable> getScopeValues(ScopeType scopeType)
Creates a Map with entries from specified scope.


putScopedValue

public void putScopedValue(ScopeType scope,
                           String key,
                           Serializable value)
Sets value for given scope and given key.


putScopedValue

public void putScopedValue(String key,
                           Serializable value)
Sets key using default scope.


clearScope

public void clearScope(ScopeType scopeType)
Removes all mappings for given scope.


Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.