org.datanucleus.cache
Class WeakRefCache

java.lang.Object
  extended by org.datanucleus.cache.WeakRefCache
All Implemented Interfaces:
Map<Object,ObjectProvider>, Level1Cache

public class WeakRefCache
extends Object
implements Level1Cache

Level 1 Cache using Weak referenced objects in a Map.

If the garbage collector clears the reference, the corresponding key is automatically removed from the map.

See Also:
WeakReference

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
WeakRefCache()
          Default constructor (required)
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 ObjectProvider get(Object key)
           
 boolean isEmpty()
           
 Set keySet()
           
 ObjectProvider put(Object key, ObjectProvider value)
           
 void putAll(Map t)
           
 ObjectProvider remove(Object key)
           
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

WeakRefCache

public WeakRefCache()
Default constructor (required)

Method Detail

put

public ObjectProvider put(Object key,
                          ObjectProvider value)
Specified by:
put in interface Map<Object,ObjectProvider>

get

public ObjectProvider get(Object key)
Specified by:
get in interface Map<Object,ObjectProvider>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<Object,ObjectProvider>

remove

public ObjectProvider remove(Object key)
Specified by:
remove in interface Map<Object,ObjectProvider>

clear

public void clear()
Specified by:
clear in interface Map<Object,ObjectProvider>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<Object,ObjectProvider>

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map<Object,ObjectProvider>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Object,ObjectProvider>

keySet

public Set keySet()
Specified by:
keySet in interface Map<Object,ObjectProvider>

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map<Object,ObjectProvider>

size

public int size()
Specified by:
size in interface Map<Object,ObjectProvider>

values

public Collection values()
Specified by:
values in interface Map<Object,ObjectProvider>


Copyright © 2013. All Rights Reserved.