public interface DataObject extends Persistent
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_VERSION |
Modifier and Type | Method and Description |
---|---|
void |
addToManyTarget(String relationshipName,
DataObject target,
boolean setReverse)
Adds an object to a to-many relationship.
|
long |
getSnapshotVersion()
Returns a version of a DataRow snapshot that was used to create this object.
|
Object |
readNestedProperty(String path)
Returns a value of the property identified by a property path.
|
Object |
readProperty(String propName)
Returns a value of the property identified by propName.
|
Object |
readPropertyDirectly(String propertyName)
Returns mapped property value as curently stored in the DataObject.
|
void |
removeToManyTarget(String relationshipName,
DataObject target,
boolean unsetReverse)
Removes an object from a to-many relationship.
|
void |
setSnapshotVersion(long snapshotVersion) |
void |
setToOneTarget(String relationshipName,
DataObject value,
boolean setReverse)
Sets to-one relationship to a new value.
|
void |
writeProperty(String propertyName,
Object value)
Sets the property to the new value.
|
void |
writePropertyDirectly(String propertyName,
Object val)
Modifies a value of a named property without altering the object state in any way,
and without triggering any database operations.
|
getObjectContext, getObjectId, getPersistenceState, setObjectContext, setObjectId, setPersistenceState
static final long DEFAULT_VERSION
void writePropertyDirectly(String propertyName, Object val)
Object readPropertyDirectly(String propertyName)
Object readNestedProperty(String path)
Property path (or nested property) is a dot-separated path used to traverse object
relationships until the final object is found. If a null object found while
traversing path, null is returned. If a list is encountered in the middle of the
path, CayenneRuntimeException is thrown. Unlike
readPropertyDirectly(String)
, this method will resolve an object if it is
HOLLOW.
Examples:
String name = (String)artist.readNestedProperty("name");
Gallery g = (Gallery)paintingInfo.readNestedProperty("toPainting.toGallery");
String name = (String)painting.readNestedProperty("toArtist.artistName");
List exhibits = (List)painting.readNestedProperty("toGallery.exhibitArray");
List<String> names = (List<String>)artist.readNestedProperty("paintingArray.paintingName");
Object readProperty(String propName)
void writeProperty(String propertyName, Object value)
setToOneTarget(String, DataObject, boolean)
.propertyName
- a name of the bean property being modified.value
- a new value of the property.void addToManyTarget(String relationshipName, DataObject target, boolean setReverse)
void removeToManyTarget(String relationshipName, DataObject target, boolean unsetReverse)
void setToOneTarget(String relationshipName, DataObject value, boolean setReverse)
relationshipName
- a name of the bean property being modified - same as the
name of ObjRelationship.value
- a new value of the property.setReverse
- whether to update the reverse relationship pointing from the old
and new values of the property to this object.long getSnapshotVersion()
void setSnapshotVersion(long snapshotVersion)
Copyright © 2001–2015 Apache Cayenne. All rights reserved.