org.apache.cayenne
Class DataRow

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.Object>
          extended by org.apache.cayenne.DataRow
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

public class DataRow
extends java.util.HashMap<java.lang.String,java.lang.Object>

DataRow a map that holds values retrieved from the database for a given query row. DataRows are used to cache raw database data and as a reference point for tracking DataObject changes.

Since:
1.1
See Also:
Serialized Form

Field Summary
protected  java.lang.String entityName
           
protected  long replacesVersion
           
protected  long version
           
 
Constructor Summary
DataRow(int initialCapacity)
           
DataRow(java.util.Map<java.lang.String,?> map)
           
 
Method Summary
 DataRow applyDiff(DataRow diff)
          Builds a new DataRow, merging changes from diff parameter with data contained in this DataRow.
 DataRow createDiff(DataRow row)
          Creates a DataRow that contains only the keys that have values that differ between this object and row parameter.
 ObjectId createTargetObjectId(java.lang.String entityName, DbRelationship relationship)
          Returns an ObjectId of an object on the other side of the to-one relationship, for this DataRow representing a source of relationship.
 java.lang.String getEntityName()
           
 long getReplacesVersion()
           
 long getVersion()
           
 void setEntityName(java.lang.String entityName)
           
 void setReplacesVersion(long replacesVersion)
          Sets the version of DataRow replaced by this one in the store.
 java.lang.String toString()
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

version

protected long version

replacesVersion

protected long replacesVersion

entityName

protected java.lang.String entityName
Since:
3.0
Constructor Detail

DataRow

public DataRow(java.util.Map<java.lang.String,?> map)

DataRow

public DataRow(int initialCapacity)
Method Detail

getVersion

public long getVersion()

getReplacesVersion

public long getReplacesVersion()

setReplacesVersion

public void setReplacesVersion(long replacesVersion)
Sets the version of DataRow replaced by this one in the store.


applyDiff

public DataRow applyDiff(DataRow diff)
Builds a new DataRow, merging changes from diff parameter with data contained in this DataRow.


createDiff

public DataRow createDiff(DataRow row)
Creates a DataRow that contains only the keys that have values that differ between this object and row parameter. Diff values are taken from the row parameter. It is assumed that key sets are compatible in both rows (e.g. they represent snapshots for the same entity). Returns null if no differences are found.


createTargetObjectId

public ObjectId createTargetObjectId(java.lang.String entityName,
                                     DbRelationship relationship)
Returns an ObjectId of an object on the other side of the to-one relationship, for this DataRow representing a source of relationship. Returns null if snapshot FK columns indicate a null to-one relationship.


toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap<java.lang.String,java.lang.Object>

getEntityName

public java.lang.String getEntityName()
Since:
3.0

setEntityName

public void setEntityName(java.lang.String entityName)
Since:
3.0


Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.