net.ontopia.utils
Class CachedGrabber

java.lang.Object
  extended by net.ontopia.utils.CachedGrabber
All Implemented Interfaces:
CachedIF, GrabberIF

public class CachedGrabber
extends java.lang.Object
implements GrabberIF, CachedIF

INTERNAL: Grabber that maintains a cache of previously grabbed objects. It works with any implementation of GrabberIF.

The cache is first checked to see if a grabbed version already exists. Otherwise the object is grabbed and the cache is updated.

If the underlying grabber is modified or replaced, the cache is not refreshed automatically. This has to be done explicitly.


Constructor Summary
CachedGrabber(GrabberIF grabber)
           
 
Method Summary
 GrabberIF getGrabber()
          Gets the grabber that is being cached.
 java.lang.Object grab(java.lang.Object object)
          Returns an object that is somehow extracted from the given object.
 void refresh()
          Refreshes the cache.
 void setGrabber(GrabberIF grabber)
          Sets the grabber that is to be cached.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedGrabber

public CachedGrabber(GrabberIF grabber)
Method Detail

getGrabber

public GrabberIF getGrabber()
Gets the grabber that is being cached.


setGrabber

public void setGrabber(GrabberIF grabber)
Sets the grabber that is to be cached. Note that the cache is not refreshed. If the cache is to be cleared call the refresh() method explicitly.


grab

public java.lang.Object grab(java.lang.Object object)
Description copied from interface: GrabberIF
Returns an object that is somehow extracted from the given object.

Specified by:
grab in interface GrabberIF

refresh

public void refresh()
Description copied from interface: CachedIF
Refreshes the cache.

Specified by:
refresh in interface CachedIF


Copyright © 2000-2009 Ontopia.