org.fjank.jcache
Class CacheObject

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.WeakReference
          extended by org.fjank.jcache.CacheObject
Direct Known Subclasses:
StreamCacheObject

public class CacheObject
extends WeakReference

Overrides some of the methods for referenceobjects.

Author:
Frank Karlstrøm

Constructor Summary
CacheObject(Object key, Object referent, CacheGroup group, CacheRegion region, ReferenceQueue q)
          Creates a new CacheObject object.
 
Method Summary
 void clear()
           
 void destroy()
          destroys this object
 boolean equals(Object arg0)
          accesses and refCount is ignored.
 Object get()
          gets the wrapped real object.
 int getAccesses()
          returns the number of total accesses to this cacheobject
 AttributesImpl getAttributes()
          gets the attributes for this object
 CacheGroup getGroup()
          gets the group this object belongs to
 Object getKey()
          gets the name of this object
 int getRefCount()
          returns an indication on how many object keep an reference to this object.
 CacheRegion getRegion()
           
 void invalidate()
          invalidates this object
 boolean needsLoading()
          returns a boolean indication wether the object needs loading or not.
 void resetRefCount()
          Resets the refcount.
 void setAttributes(Attributes attributes)
           
 void setAttributes(AttributesImpl attributes)
          sets the attributes for this object
 String toString()
          returns a string representation of this object
 
Methods inherited from class java.lang.ref.Reference
enqueue, isEnqueued
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheObject

public CacheObject(Object key,
                   Object referent,
                   CacheGroup group,
                   CacheRegion region,
                   ReferenceQueue q)
Creates a new CacheObject object.

Parameters:
key - the name of this object
referent - the actuall object
group - the group this object belongs to
q - the ReferenceQueue this object goes to wneh the GC determines that this object is garbage.
Method Detail

equals

public boolean equals(Object arg0)
accesses and refCount is ignored.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

needsLoading

public boolean needsLoading()
returns a boolean indication wether the object needs loading or not.

Returns:
a boolean indication wether the object needs loading or not.

destroy

public void destroy()
destroys this object


invalidate

public void invalidate()
invalidates this object


get

public Object get()
gets the wrapped real object.

Overrides:
get in class Reference
Returns:
the wrapped real object.

toString

public String toString()
returns a string representation of this object

Overrides:
toString in class Object
Returns:
a string representation of this object

getKey

public Object getKey()
gets the name of this object

Returns:
the name of this object

setAttributes

public void setAttributes(AttributesImpl attributes)
sets the attributes for this object

Parameters:
attributes - the attributes to set.

setAttributes

public void setAttributes(Attributes attributes)

getAttributes

public AttributesImpl getAttributes()
gets the attributes for this object

Returns:
the attributes for this object

getGroup

public CacheGroup getGroup()
gets the group this object belongs to

Returns:
the group this object belongs to

getAccesses

public int getAccesses()
returns the number of total accesses to this cacheobject

Returns:
the number of total accesses to this cacheobject

getRefCount

public int getRefCount()
returns an indication on how many object keep an reference to this object. if this number is positive, its only an indication, not a real numer. if its 0, the refcount is 0.

Returns:
an indication on how many object keep an reference to this object.

resetRefCount

public void resetRefCount()
Resets the refcount.


getRegion

public CacheRegion getRegion()
Returns:

clear

public void clear()
Overrides:
clear in class Reference


Copyright © 2002-2009 Hosted by SourceForge. All Rights Reserved.