org.jasig.portal.utils.cache
Class MapCacheProvider<K extends Serializable,V>

java.lang.Object
  extended by org.jasig.portal.utils.cache.MapCacheProvider<K,V>
All Implemented Interfaces:
Map<K,V>

public class MapCacheProvider<K extends Serializable,V>
extends Object
implements Map<K,V>

Hides a CacheProviderFacade behind a the Map interface. Only the following methods are supported:

The put(Serializable, Object) and remove(Object) methods call get(Object) before performing the requested operation to be able to return the 'old' value.

Version:
$Revision$
Author:
Eric Dalquist

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MapCacheProvider(org.springmodules.cache.provider.CacheProviderFacade cacheProviderFacade, org.springmodules.cache.CachingModel cachingModel, org.springmodules.cache.FlushingModel flushModel)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
          This does "get(Object) != null".
 boolean containsValue(Object value)
           
 Set<Map.Entry<K,V>> entrySet()
           
 boolean equals(Object object)
           
 V get(Object key)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set<K> keySet()
           
 V put(K key, V value)
           
 void putAll(Map<? extends K,? extends V> t)
           
 V remove(Object key)
           
 int size()
           
 String toString()
           
 Collection<V> values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapCacheProvider

public MapCacheProvider(org.springmodules.cache.provider.CacheProviderFacade cacheProviderFacade,
                        org.springmodules.cache.CachingModel cachingModel,
                        org.springmodules.cache.FlushingModel flushModel)
Parameters:
cacheProviderFacade - The facade to expose as a Map.
cachingModel - The cache model to use for storing and retrieving data
flushModel - The flushing model to use when clearing the cache
Method Detail

clear

public void clear()
Specified by:
clear in interface Map<K extends Serializable,V>

containsKey

public boolean containsKey(Object key)
This does "get(Object) != null".

Specified by:
containsKey in interface Map<K extends Serializable,V>
See Also:
Map.containsKey(java.lang.Object)

get

public V get(Object key)
Specified by:
get in interface Map<K extends Serializable,V>

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K extends Serializable,V>

putAll

public void putAll(Map<? extends K,? extends V> t)
Specified by:
putAll in interface Map<K extends Serializable,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K extends Serializable,V>

equals

public boolean equals(Object object)
Specified by:
equals in interface Map<K extends Serializable,V>
Overrides:
equals in class Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<K extends Serializable,V>
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<K extends Serializable,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K extends Serializable,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K extends Serializable,V>

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K extends Serializable,V>

size

public int size()
Specified by:
size in interface Map<K extends Serializable,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K extends Serializable,V>


Copyright © 2010 Jasig. All Rights Reserved.