net.sf.spif
Class HashStore

java.lang.Object
  |
  +--net.sf.spif.StoreChain
        |
        +--net.sf.spif.HashStore

public class HashStore
extends StoreChain

A store backed by a plain HashMap. Put is always propagated, get is never propagated.

Version:
$Id: HashStore.java,v 1.2 2003/02/05 22:15:44 bratseth Exp $
Author:
Jon S Bratseth

Field Summary
 
Fields inherited from class net.sf.spif.StoreChain
chained
 
Constructor Summary
HashStore()
           
 
Method Summary
 void clear()
          Forgets everything
 java.lang.Object get(Id id, boolean writeable)
          Returns an object from the store.
 Id put(Id id, java.lang.Object object)
          Puts an object in the store.
 boolean remove(Id id)
          Removes and propagates
 
Methods inherited from class net.sf.spif.StoreChain
equals, getChained, getChained, getChained, hashCode, setChained
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashStore

public HashStore()
Method Detail

get

public java.lang.Object get(Id id,
                            boolean writeable)
Description copied from class: StoreChain

Returns an object from the store.

This default implementation just forwards to the chained. for (optional) use by subclasses.

Overrides:
get in class StoreChain
Parameters:
id - the id of the object to return
Returns:
the object, or null if the object could not be retrieved or if the input id was null

put

public Id put(Id id,
              java.lang.Object object)
Description copied from class: StoreChain

Puts an object in the store. The objects may be new, or previously acquired by getting writeable. It is an error to attempt to put an existing object not previously acquired by getting writeable.

This default implementation just forwards to the chained. for (optional) use by subclasses.

Overrides:
put in class StoreChain
Parameters:
id - the id of the object to put. May be null
object - the object to put. May be null
Returns:
the id of this object. This will usually be (and is in this default implementation) the input id, unless the given id is null and there is an id generating service on the store chain

remove

public boolean remove(Id id)
Removes and propagates

Overrides:
remove in class StoreChain
Parameters:
id - the id of the object to remove
Returns:
true if the object did not exists

clear

public void clear()
Forgets everything

Overrides:
clear in class StoreChain


Spif 1.01 (2003-04-03). http://spif.sf.net