org.melati.poem.util
Class CachedIndexFactory

Package class diagram package CachedIndexFactory
java.lang.Object
  extended by org.melati.poem.util.CachedIndexFactory
All Implemented Interfaces:
IndexFactory
Direct Known Subclasses:
PreparedStatementFactory

public abstract class CachedIndexFactory
extends Object
implements IndexFactory

Supply and cache objects identified by a numeric index.

Subtypes define how the object for a given index is obtained, and hence the mapping of indexes to objects used in the caller.

The name is a touch misleading - the objects returned are not (necessarily) indexes.

null object references can be cached and returned.

Individual elements can be removed from the cache or all elements may be removed.


Constructor Summary
CachedIndexFactory()
           
 
Method Summary
 Object get(int index)
          Get either from cache or, failing that, really get it.
 void invalidate()
          Invalidate whole cache.
 void invalidate(int index)
          Invalidate an entry in the cache.
protected abstract  Object reallyGet(int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedIndexFactory

public CachedIndexFactory()
Method Detail

reallyGet

protected abstract Object reallyGet(int index)
Parameters:
index - of the item, possibly a troid
Returns:
the cached Object

get

public Object get(int index)
Get either from cache or, failing that, really get it.

Specified by:
get in interface IndexFactory
Parameters:
index - the index
Returns:
the object
See Also:
IndexFactory.get(int)

invalidate

public void invalidate(int index)
Invalidate an entry in the cache.

Parameters:
index - the entry's index to invalidate

invalidate

public void invalidate()
Invalidate whole cache.



Copyright © 2000-2010 PanEris. All Rights Reserved.