Class DataRow
java.lang.Object
org.apache.cayenne.DataRow
- All Implemented Interfaces:
Serializable, Map<String,Object>
DataRow is a precursor of a persistent object that holds its database values, but models no relationships. A row is
immutable and the mutating Map methods throw
UnsupportedOperationException. A row is serializable when its
values are. Rows serialized in one stream keep sharing their layout.- Since:
- 1.1
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanCompares the rows as maps, i.e. by their keys and values and regardless of their entity names, versions or the order of their columns.voidforEach(BiConsumer<? super String, ? super Object> action) Visits the entries in column order.Returns the name of the ObjEntity this row is a snapshot of, or null if the row is not mapped to an entity.getOrDefault(Object key, Object defaultValue) longReturns thesnapshot versionof this row: the version of the operation (a SQL statement result, a commit) that produced it.inthashCode()booleanisEmpty()keySet()Returns a row with this row's entity name and the given version, holding this row's values overlaid with the given ones.static DataRowof(String entityName, DataRowLayout layout, Object[] values, long version) Creates a row over the given values laid out by the given layout, with the given entity name and snapshot version.voidintsize()toString()values()withEntityName(String entityName) Returns a row with the given entity name and this row's values and version.Methods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
of
Creates a row over the given values laid out by the given layout, with the given entity name and snapshot version. The array is not copied: the row takes ownership of it, and the caller must not use the array after this call.- Since:
- 5.0
-
getEntityName
Returns the name of the ObjEntity this row is a snapshot of, or null if the row is not mapped to an entity.- Since:
- 3.0
-
getVersion
public long getVersion()Returns thesnapshot versionof this row: the version of the operation (a SQL statement result, a commit) that produced it. -
withEntityName
-
merged
-
size
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,Object>
-
get
-
getOrDefault
-
put
-
remove
-
putAll
-
clear
-
keySet
-
values
-
entrySet
-
forEach
-
equals
-
hashCode
-
toString
-