Cumulus4j API
(1.0.0)

org.cumulus4j.store.model
Class ObjectContainer

java.lang.Object
  extended by org.cumulus4j.store.model.ObjectContainer
All Implemented Interfaces:
Serializable, Cloneable

public class ObjectContainer
extends Object
implements Serializable, Cloneable

Container holding the values of a persistent object.

Objects to be stored in the database, are first represented by an instance of ObjectContainer and then serialised into a byte-array, which is finally encrypted and put into a DataEntry's value.

Note, that references to other objects are either not stored at all (in a "mapped-by"-relationship) or stored via the other object's dataEntryID; a persistent object is never stored as-is.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de
See Also:
Serialized Form

Constructor Summary
ObjectContainer()
           
 
Method Summary
 ObjectContainer clone()
           
 Map<Long,Object> getFieldID2value()
           
 Object getValue(long fieldID)
          Get a value.
 Object getVersion()
          Get the object's version or null, if the persistence-capable class has no versioning enabled.
 void setValue(long fieldID, Object value)
          Set a value.
 void setVersion(Object version)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectContainer

public ObjectContainer()
Method Detail

getValue

public Object getValue(long fieldID)
Get a value.

Parameters:
fieldID - the field's persistent ID, i.e. a reference to FieldMeta.fieldID.
Returns:
the value or null.

setValue

public void setValue(long fieldID,
                     Object value)
Set a value.

Parameters:
fieldID - the field's persistent ID, i.e. a reference to FieldMeta.fieldID.
value - either the raw value or the object-ID of a persistable object. Persistable objects are never stored directly in an ObjectContainer.

getFieldID2value

public Map<Long,Object> getFieldID2value()

getVersion

public Object getVersion()
Get the object's version or null, if the persistence-capable class has no versioning enabled. The version can be a Long, a Date or anything else supported by DataNucleus/JDO.

Returns:
the object's version or null.

setVersion

public void setVersion(Object version)

clone

public ObjectContainer clone()
Overrides:
clone in class Object

Cumulus4j API
(1.0.0)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.