|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.spy.SpyObject
net.spy.factory.GenFactory<T>
public abstract class GenFactory<T>
Generic object instance cache for objects collections suitable of being stored completely in memory.
| Constructor Summary | |
|---|---|
protected |
GenFactory(String key,
long time)
Get an instance of GenFactory. |
| Method Summary | |
|---|---|
protected void |
cacheInstance(T i)
Store or update an individual object in the cache. |
protected Storage<T> |
getCache()
Get the cache for this factory. |
protected abstract Collection<T> |
getInstances()
Get the collection of all Instance objects to be cached. |
long |
getLastRefresh()
Get the timestamp of the last time this was refreshed. |
T |
getObject(int id)
Convenience method for getObject(String,Object) assuming an integer field uniquely cached as ``id.'' |
T |
getObject(String cacheName,
Object key)
Get an object from an alternate cache by cache name and key. |
Collection<T> |
getObjects()
Get all objects cached by this factory. |
Collection<T> |
getObjects(String cacheName,
Object key)
Get all of the objects mapped with the given key under the given cache name. |
protected T |
handleNullLookup(String cacheName,
Object key)
This method is called whenever getObject(String,Object) would return null. |
void |
recache()
Reset the cache for this factory. |
| Methods inherited from class net.spy.SpyObject |
|---|
getLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected GenFactory(String key,
long time)
key - the cache key to usetime - the refresh duration of the cache| Method Detail |
|---|
protected Storage<T> getCache()
protected void cacheInstance(T i)
throws Exception
i - the object to store
Exception - if the cache cannot be updated with this instanceprotected abstract Collection<T> getInstances()
protected T handleNullLookup(String cacheName,
Object key)
cacheName - the name of the cache that was accessedkey - the key under that cache that was accessed
public T getObject(String cacheName,
Object key)
cacheName - the name of the alt cachekey - the key under which to look
public T getObject(int id)
id - the id value
public Collection<T> getObjects(String cacheName,
Object key)
cacheName - the name of the cachekey - the key with that name
public Collection<T> getObjects()
public void recache()
public long getLastRefresh()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||