net.sf.dc.core.objects.cache
Class Cache

java.lang.Object
  extended bynet.sf.dc.core.objects.cache.Cache

public class Cache
extends java.lang.Object

Caches data crow objects in memory. This prevents the application from having to go to the database for regurarly used values. Commonly cached objects are small and are mostly diplayed in combo boxes (such as the Software Category)

Since:
1.3
Version:
1.00
Author:
Robert-Jan van der Waals

Constructor Summary
Cache(DCObject o)
          Initializes the cache for a specific data crow object
 
Method Summary
 void clear()
          Clears the cache
 DCObject[] getCachedObjects()
          Retrieves all the cached objects
 DCObject getObjectForDisplayValue(java.lang.String s)
          Retrieves the cached object with the given display value (toString() value)
 DCObject getObjectForID(java.lang.String id)
          Retrieves the cached object with the given ID
 void load()
          Retrieves the objects to be cached.
 void registerUIComponent(javax.swing.JComboBox combo)
          Register a combo box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(DCObject o)
Initializes the cache for a specific data crow object

Parameters:
o - data crow object used as a reference
Method Detail

registerUIComponent

public void registerUIComponent(javax.swing.JComboBox combo)
Register a combo box. This combo box will be updated with the currently cached values. Everytime the cache is refreshed, this combo box will be refreshed as well.

Parameters:
combo - combo box to be registered

getCachedObjects

public DCObject[] getCachedObjects()
Retrieves all the cached objects


clear

public void clear()
Clears the cache


getObjectForDisplayValue

public DCObject getObjectForDisplayValue(java.lang.String s)
Retrieves the cached object with the given display value (toString() value)

Parameters:
s - display value to search on

getObjectForID

public DCObject getObjectForID(java.lang.String id)
Retrieves the cached object with the given ID

Parameters:
id - ID to search on

load

public final void load()
Retrieves the objects to be cached. All items of the data crow object type will be retrieved and added to the cache.