org.fjank.jcache
Class CacheGroup

java.lang.Object
  extended by org.fjank.jcache.CacheGroup
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CacheRegion

public class CacheGroup
extends Object
implements Serializable

Class for representin grouops in the cache. Groups can contain CacheObjects and other groups.

Author:
Frank Karlstrøm
See Also:
Serialized Form

Field Summary
protected  String name
          the name of this group.
protected  Map weakReferenceObjects
          the WeakReference objects in this group.
 
Constructor Summary
CacheGroup(String name)
          Creates a new CacheGroup object.
CacheGroup(String name, AttributesImpl attributes)
          Creates a new CacheGroup object.
 
Method Summary
 boolean contains(Object aName)
          Checks wether this group contains the specified objects
 boolean containsValue(Object value)
          returns a boolean indicating wether this value is present in the cache root.
 void destroy()
          Destroys this group and all its children.
 Set entrySet()
           
 Object get(Object aName)
          gets an object from this group.
 CacheGroup getGroup(String group)
          gets the named group from this group.
 String getName()
          gets the name of this group.
 int getObjectCount()
          Return the current number of objects in this group.
 void invalidate()
          Setter for property valid.
 Set keySet()
           
 void put(CacheGroup group)
          puts the group into this group
 void put(Object name, CacheObject object, Object realObject)
          puts the named object into this group.
 void removeMe(CacheObject object)
          removes the object from this group.
 CacheObject replace(Object name, CacheObject object)
          Will create a new version of the object indentified by the name, replacing the current version with the object specified.
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
the name of this group.


weakReferenceObjects

protected transient Map weakReferenceObjects
the WeakReference objects in this group.

Constructor Detail

CacheGroup

public CacheGroup(String name)
Creates a new CacheGroup object.

Parameters:
name - the name of the CacheGroup to create

CacheGroup

public CacheGroup(String name,
                  AttributesImpl attributes)
Creates a new CacheGroup object.

Parameters:
name - the name of the CacheGroup to create
attributes - the attributes of the group to create
Method Detail

get

public Object get(Object aName)
gets an object from this group.

Parameters:
name - the name of the object to retrieve.
Returns:
the named object, or null if it is not found.

put

public void put(Object name,
                CacheObject object,
                Object realObject)
puts the named object into this group.

Parameters:
name - the name of the object
object - the object to insert.

put

public void put(CacheGroup group)
puts the group into this group

Parameters:
object - the group to put.

replace

public CacheObject replace(Object name,
                           CacheObject object)
Will create a new version of the object indentified by the name, replacing the current version with the object specified. If the object doesn't exist in the cache, replace is equivalent to a put. The attributes will be inherited from the existing object or if no object exists, from the group or region the object associated with. Names are in the scope of a region so they must be unique within the region they are placed. This method is not valid on a disk, StreamAccess or Group Object.

Parameters:
name - the name of the object to replace.
object - The new object to be put in the cache.
Returns:
a reference to the newly replaced object.

invalidate

public void invalidate()
Setter for property valid.


destroy

public void destroy()
Destroys this group and all its children.


contains

public boolean contains(Object aName)
Checks wether this group contains the specified objects

Parameters:
aName - the name of the object to check
Returns:
a boolean indicating wether the object was present or not in this group.

removeMe

public void removeMe(CacheObject object)
removes the object from this group.

Parameters:
object - the object to remove.

getGroup

public CacheGroup getGroup(String group)
gets the named group from this group. If no group with the specified name is found, null is returned.

Parameters:
group - the group to get.
Returns:
the named group.

getName

public String getName()
gets the name of this group.

Returns:
the name of this group.

getObjectCount

public int getObjectCount()
Return the current number of objects in this group.

Returns:
the current number of objects in this group.

containsValue

public boolean containsValue(Object value)
returns a boolean indicating wether this value is present in the cache root.

Parameters:
value - the value to check
Returns:
true if the value is present, false otherwise.

keySet

public Set keySet()

values

public Collection values()

entrySet

public Set entrySet()


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