net.sourceforge.pbeans
Class PersistentMap<TKey,TValue>

java.lang.Object
  extended by net.sourceforge.pbeans.PersistentMap<TKey,TValue>

public class PersistentMap<TKey,TValue>
extends java.lang.Object

A persistent map of strings to Persistent objects. Note: Use this class only when you need a map of keys to objects of different types. If you simply need to retrieve objects of a known type by a property value, use one of the Store.selectParts(Object, Class, String) methods in Store.


Constructor Summary
PersistentMap()
           
 
Method Summary
 TValue get(TKey key)
          Gets a persistent instance mapped to a string.
 java.lang.String getName()
           
 TValue getObject(TKey key)
           
 Store getStore()
           
 TValue put(TKey key, TValue value)
          Maps a key to a value.
 TValue putObject(TKey key, TValue value)
           
 TValue remove(TKey key)
          Removes a mapping for the given key, if it exists.
 TValue removeObject(TKey key)
           
 void setName(java.lang.String name)
           
 void setStore(Store store)
          This transient Store value must be set before map methods can work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentMap

public PersistentMap()
Method Detail

getStore

public Store getStore()

setStore

public void setStore(Store store)
This transient Store value must be set before map methods can work.


getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

put

public TValue put(TKey key,
                  TValue value)
Maps a key to a value.

Parameters:
key - Must be of type String, Integer or Long.
value - Must implement Persistent.

get

public TValue get(TKey key)
Gets a persistent instance mapped to a string.

Parameters:
key - Must be of type String, Integer or Long.

remove

public TValue remove(TKey key)
Removes a mapping for the given key, if it exists.

Parameters:
key - Must be of type String, Integer or Long.

putObject

public TValue putObject(TKey key,
                        TValue value)
                 throws StoreException
Throws:
StoreException

getObject

public TValue getObject(TKey key)
                 throws StoreException
Throws:
StoreException

removeObject

public TValue removeObject(TKey key)
                    throws StoreException
Throws:
StoreException