net.sf.ashkay.strategies
Class SoftReferenceCacheEntry

java.lang.Object
  extended bynet.sf.ashkay.CacheEntry
      extended bynet.sf.ashkay.strategies.SoftReferenceCacheEntry

public class SoftReferenceCacheEntry
extends CacheEntry

SoftReferenceCacheEntry represents a cache entry that is wrapped in which the entry object is wrapped in a SoftReference in order to allow the garbage collector to still collect the object if all other hard references are destroyed.

Often, this strategy will be used in memory sensative caches.

Author:
Dave Brown
See Also:
SoftReference

Constructor Summary
SoftReferenceCacheEntry(CacheEntry originalEntry, java.lang.ref.ReferenceQueue queue)
           
 
Method Summary
 void addProperties(java.util.Map propertiesToAdd)
          Adds a group of properties to this entry, en masse
 void addProperty(java.lang.Object key, java.lang.Object value)
          Adds a property to this entry.
 ObjectCache getCache()
           
 java.lang.Object getEntryKey()
           
 java.lang.Object getEntryObject()
          Returns the object this entry represents.
(package private)  java.lang.ref.SoftReference getEntryReference()
           
 java.util.Map getProperties()
          Returns the entire Map of this entry's properties
 java.lang.Object getProperty(java.lang.Object key)
          Looks up a property of this entry
 void setCache(ObjectCache myCache)
           
 void setEntryKey(java.lang.Object key)
           
 void setEntryObject(java.lang.Object entryObject)
          Sets the object this entry represents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftReferenceCacheEntry

public SoftReferenceCacheEntry(CacheEntry originalEntry,
                               java.lang.ref.ReferenceQueue queue)
Method Detail

getEntryReference

java.lang.ref.SoftReference getEntryReference()

getEntryObject

public java.lang.Object getEntryObject()
Description copied from class: CacheEntry
Returns the object this entry represents.

Overrides:
getEntryObject in class CacheEntry
Returns:
the entries object

addProperties

public void addProperties(java.util.Map propertiesToAdd)
Description copied from class: CacheEntry
Adds a group of properties to this entry, en masse

Overrides:
addProperties in class CacheEntry
Parameters:
propertiesToAdd - - map of properties to add

addProperty

public void addProperty(java.lang.Object key,
                        java.lang.Object value)
Description copied from class: CacheEntry
Adds a property to this entry.

Overrides:
addProperty in class CacheEntry
Parameters:
key - - the key to this property
value - - the value to hold in the property

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Description copied from class: CacheEntry
Looks up a property of this entry

Overrides:
getProperty in class CacheEntry
Parameters:
key - - the key of the property to lookup
Returns:
the value of the property or null if not set

setEntryObject

public void setEntryObject(java.lang.Object entryObject)
Description copied from class: CacheEntry
Sets the object this entry represents

Overrides:
setEntryObject in class CacheEntry
Parameters:
entryObject - - the new object to represent

getEntryKey

public java.lang.Object getEntryKey()
Overrides:
getEntryKey in class CacheEntry

setEntryKey

public void setEntryKey(java.lang.Object key)
Overrides:
setEntryKey in class CacheEntry

getProperties

public java.util.Map getProperties()
Description copied from class: CacheEntry
Returns the entire Map of this entry's properties

Overrides:
getProperties in class CacheEntry
Returns:
the properties

getCache

public ObjectCache getCache()
Overrides:
getCache in class CacheEntry

setCache

public void setCache(ObjectCache myCache)
Overrides:
setCache in class CacheEntry


Copyright © 2004 . All Rights Reserved.