SPT Object Database API

com.sptci.prevayler
Class ReferenceStorage

java.lang.Object
  extended by com.sptci.prevayler.ReferenceStorage
All Implemented Interfaces:
Serializable

public class ReferenceStorage
extends Object
implements Serializable

A class used as the storage mechanism for storing the references to other prevalent objects from prevalent objects stored in the system.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: ReferenceStorage.java 4345 2008-06-30 21:22:03Z rakesh $
Author:
Rakesh Vidyadharan 2008-05-23
See Also:
Serialized Form

Nested Class Summary
private  class ReferenceStorage.FieldStorage
          The storage for all the references fields in a prevalent object.
 
Field Summary
private static long serialVersionUID
           
private  Map<Object,ReferenceStorage.FieldStorage> storage
          A map used to maintain the references for a prevalent object identified by its object id.
 
Constructor Summary
ReferenceStorage()
           
 
Method Summary
 void add(PrevalentObject object, String name, Object oid)
          Add the specified reference information for the prevalent object to the store.
 Collection<String> getFields(PrevalentObject object)
          Return a collection of field names that represent the references to other prevalent objects in the store for the specified prevalent object.
 Object getValue(PrevalentObject object, String name)
          Return the value associated with the specified prevalent object and reference field name.
 void remove(PrevalentObject object)
          Remove the specified prevalent object from the store.
 void remove(PrevalentObject object, String field)
          Remove the reference(s) for the specified field in the specified prevalent object.
 void remove(PrevalentObject object, String field, Object objectId)
          Remove the reference for the specified prevalent object from the specified field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

storage

private final Map<Object,ReferenceStorage.FieldStorage> storage
A map used to maintain the references for a prevalent object identified by its object id.

Constructor Detail

ReferenceStorage

public ReferenceStorage()
Method Detail

add

public void add(PrevalentObject object,
                String name,
                Object oid)
Add the specified reference information for the prevalent object to the store.

Parameters:
object - The prevalent object whose reference information is being added to the store.
name - The name of the field that contains a reference.
oid - The oid for the referenced field.
See Also:
ReferenceStorage.FieldStorage.add(java.lang.String, java.lang.Object)

getFields

public Collection<String> getFields(PrevalentObject object)
Return a collection of field names that represent the references to other prevalent objects in the store for the specified prevalent object.

Parameters:
object - The prevalent object whose references are to be fetched.
Returns:
The collection of referenced field names.
See Also:
ReferenceStorage.FieldStorage.getFields()

getValue

public Object getValue(PrevalentObject object,
                       String name)
Return the value associated with the specified prevalent object and reference field name.

Parameters:
object - The prevalent object in which the referenced field exists
name - The name of the reference field.
Returns:
The value associated with the object in the store.
See Also:
ReferenceStorage.FieldStorage.getValue(java.lang.String)

remove

public void remove(PrevalentObject object)
Remove the specified prevalent object from the store.

Parameters:
object - The prevalent object to remove from the store.

remove

public void remove(PrevalentObject object,
                   String field)
Remove the reference(s) for the specified field in the specified prevalent object.

Parameters:
object - The prevalent object whose field reference(s) are to be removed.
field - The field whose reference(s) are to be removed.

remove

public void remove(PrevalentObject object,
                   String field,
                   Object objectId)
Remove the reference for the specified prevalent object from the specified field.

Parameters:
object - The prevalent object whose reference is to be removed.
field - The field in the prevalent object whose reference is to be removed.
objectId - The reference that is to be removed.

SPT Object Database API