net.spy.factory
Class HashCacheEntry<T extends Instance>

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.factory.HashCacheEntry<T>
All Implemented Interfaces:
CacheEntry<T>

public class HashCacheEntry<T extends Instance>
extends SpyObject
implements CacheEntry<T>

An implementation of CacheEntry that is backed by a HashMap.


Constructor Summary
HashCacheEntry()
          Get an instance of HashCacheEntry.
 
Method Summary
 void cacheInstance(T i)
          Cache this instance.
 java.util.Collection<T> getAllObjects()
          Get all of the objects in this cache.
 T getById(int id)
          Get the object at this ID.
 
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

HashCacheEntry

public HashCacheEntry()
Get an instance of HashCacheEntry.

Method Detail

cacheInstance

public void cacheInstance(T i)
Cache this instance.

Specified by:
cacheInstance in interface CacheEntry<T extends Instance>

getById

public T getById(int id)
Get the object at this ID.

Specified by:
getById in interface CacheEntry<T extends Instance>
Parameters:
id - the object ID
Returns:
the object, or null if there's no object by this ID

getAllObjects

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

Specified by:
getAllObjects in interface CacheEntry<T extends Instance>
Returns:
an unmodifiable collection of object instances


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