ahc.collection
Class Cache

java.lang.Object
  |
  +--ahc.collection.Cache

public abstract class Cache
extends java.lang.Object

This abstract class serves as a generic base for a cache that returns an instance based on a parameter. The first time the get method is called for a parameter, the corresponding instance is created by calling the abstract createNew method, for subsequent calls with the same parameter (using equals), the cached instance that was created on the first call is returned.

Author:
Arno Haase

Constructor Summary
Cache()
           
 
Method Summary
protected abstract  java.lang.Object createNew(java.lang.Object key)
           
 java.lang.Object get(java.lang.Object key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

get

public java.lang.Object get(java.lang.Object key)

createNew

protected abstract java.lang.Object createNew(java.lang.Object key)