org.bridj.util
Class ConcurrentCache<K,V>

java.lang.Object
  extended by org.bridj.util.ConcurrentCache<K,V>

public class ConcurrentCache<K,V>
extends Object

Cache that creates its missing values automatically, using the value class' default constructor (override newInstance(Object) to call another constructor)


Field Summary
protected  ConcurrentHashMap<K,V> map
           
protected  Class<V> valueClass
           
 
Constructor Summary
ConcurrentCache(Class<V> valueClass)
           
 
Method Summary
 void clear()
           
 Iterable<Map.Entry<K,V>> entrySet()
           
 V get(K key)
           
protected  V newInstance(K key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final ConcurrentHashMap<K,V> map

valueClass

protected final Class<V> valueClass
Constructor Detail

ConcurrentCache

public ConcurrentCache(Class<V> valueClass)
Method Detail

newInstance

protected V newInstance(K key)

get

public V get(K key)

clear

public void clear()

entrySet

public Iterable<Map.Entry<K,V>> entrySet()


Copyright © 2009-2012. All Rights Reserved.