SRJRCFrames
v0.1.296

de.schwarzrot.data.access
Class EntityHolder

java.lang.Object
  extended by de.schwarzrot.data.access.EntityHolder

public class EntityHolder
extends Object

another wrapper around HashMap, used to cache entity instances already read from persistence.

Author:
Reinhard Mantey

Constructor Summary
EntityHolder()
           
 
Method Summary
 void clear()
          clear the cache and force all entities to get read again from storage
 boolean contains(Class<? extends Entity> entityType, long id)
          returns true, if the instance identified by entityType and id is cached, otherwise false
 void dumpStats()
          tell some statistics about entity cache
 Entity get(Class<? extends Entity> entityType, long id)
          returns instance identified by entityType and id.
 void put(Entity e)
          puts an instance to cache
 void remove(Class<? extends Entity> entityType, long id)
          remove instance from cache
 void remove(Class<? extends Entity> entityType, long[] idList)
          remove a number of instances from cache, identified by entity type and list of ids
 void removeRelated(Class<?> relatedType, Entity parent, EntityDescriptor ed)
          remove instances from cache, that are related to given parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityHolder

public EntityHolder()
Method Detail

clear

public void clear()
clear the cache and force all entities to get read again from storage


contains

public boolean contains(Class<? extends Entity> entityType,
                        long id)
returns true, if the instance identified by entityType and id is cached, otherwise false

Parameters:
entityType - - the class to search
id - - the id to search
Returns:
- true if the instance is cached, otherwise false

dumpStats

public void dumpStats()
tell some statistics about entity cache


get

public Entity get(Class<? extends Entity> entityType,
                  long id)
returns instance identified by entityType and id.

Parameters:
entityType - - class to search
id - - id to search
Returns:
- the cached instance or null

put

public void put(Entity e)
puts an instance to cache

Parameters:
e - - instance to cache

remove

public void remove(Class<? extends Entity> entityType,
                   long id)
remove instance from cache

Parameters:
entityType - - the class of instance to remove
id - - the id of instance to remove

remove

public void remove(Class<? extends Entity> entityType,
                   long[] idList)
remove a number of instances from cache, identified by entity type and list of ids

Parameters:
entityType - - the class of instances to remove
idList - - the list of ids to remove

removeRelated

public void removeRelated(Class<?> relatedType,
                          Entity parent,
                          EntityDescriptor ed)
remove instances from cache, that are related to given parent

Parameters:
relatedType - - class of instances to remove
parent - - parent the instances to remove are related to
ed - - the entity descriptor

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.