org.apache.ojb.broker.cache
Class ObjectCachePerClassImpl

java.lang.Object
  extended by org.apache.ojb.broker.cache.AbstractMetaCache
      extended by org.apache.ojb.broker.cache.ObjectCachePerClassImpl
All Implemented Interfaces:
ObjectCache

public class ObjectCachePerClassImpl
extends AbstractMetaCache

Global ObjectCache implementation.

Version:
$Id: ObjectCachePerClassImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
matthew.baird

Field Summary
 
Fields inherited from class org.apache.ojb.broker.cache.AbstractMetaCache
METHOD_CACHE, METHOD_LOOKUP, METHOD_REMOVE
 
Constructor Summary
ObjectCachePerClassImpl(PersistenceBroker broker, java.util.Properties prop)
          Constructor for the ObjectCachePerClassImpl object
 
Method Summary
 void clear()
          Clears the cache
 ObjectCache getCache(Identity oid, java.lang.Object obj, int methodCall)
          This method handle all calls against the ObjectCache interface.
 void setClassCache(java.lang.Class objectClass, ObjectCache cache)
          Sets the ObjectCache implementation to use for objects with the given type and subclasses
 
Methods inherited from class org.apache.ojb.broker.cache.AbstractMetaCache
cache, cacheIfNew, lookup, remove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCachePerClassImpl

public ObjectCachePerClassImpl(PersistenceBroker broker,
                               java.util.Properties prop)
Constructor for the ObjectCachePerClassImpl object

Method Detail

getCache

public ObjectCache getCache(Identity oid,
                            java.lang.Object obj,
                            int methodCall)
Description copied from class: AbstractMetaCache
This method handle all calls against the ObjectCache interface. Note: The parameter obj can be null - e.g. when lookup or remove method was called.

Specified by:
getCache in class AbstractMetaCache
Parameters:
oid - Identity of the target object.
obj - The target object itself or null if not available.
methodCall - Specifies the type of method call against the ObjectCache interface. AbstractMetaCache.METHOD_CACHE, AbstractMetaCache.METHOD_LOOKUP, AbstractMetaCache.METHOD_REMOVE.
Returns:
The ObjectCache implementation.

clear

public void clear()
Clears the cache


setClassCache

public void setClassCache(java.lang.Class objectClass,
                          ObjectCache cache)
Sets the ObjectCache implementation to use for objects with the given type and subclasses

Parameters:
objectClass - The object's class, use java.lang.Object to alter default caching for all objects which have no special caching defined
cache - The new ObjectCache implementation to use for this class and subclasses, null to switch off caching for the given class


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30