net.spy.factory
Class Storage<T>

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.factory.Storage<T>

public class Storage<T>
extends SpyObject

An implementation of CacheEntry that is backed by a HashMap. This implementation will find any public methods on the given objects containing a CacheKey annotation, or any fields with any visibility declared only within the classes of the given objects and use them as cache hints.


Constructor Summary
Storage(Collection<T> obs)
          Get an instance of HashCacheEntry.
 
Method Summary
 void cacheInstance(T i)
          Cache this instance.
 Collection<T> getAllObjects()
          Get all of the objects in this cache.
 T getObject(String cacheName, Object key)
          Get a specific object by cache name and key.
 Collection<T> getObjects(String cacheName, Object key)
          Get the objects multicached to a particular key.
 
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

Storage

public Storage(Collection<T> obs)
Get an instance of HashCacheEntry.

Method Detail

cacheInstance

public void cacheInstance(T i)
                   throws Exception
Cache this instance.

Throws:
Exception

getAllObjects

public Collection<T> getAllObjects()
Get all of the objects in this cache.

Returns:
an unmodifiable collection of object instances

getObject

public T getObject(String cacheName,
                   Object key)
Get a specific object by cache name and key.

Parameters:
cacheName - the name of the cache containing the object
key - the key under which the object is cached
Returns:
the object, or null if there's no match

getObjects

public Collection<T> getObjects(String cacheName,
                                Object key)
Get the objects multicached to a particular key.

Parameters:
cacheName - the name of the cache containing the objects
key - the key under which the objects are cached
Returns:
all the matching objects, or an empty collection if no match


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.