Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Examples/SDO/BasicAPI"
< EclipseLink | Examples | SDO
(→EqualityHelper - Compare DataObjects) |
|||
Line 12: | Line 12: | ||
==CopyHelper - Create Copies of DataObjects== | ==CopyHelper - Create Copies of DataObjects== | ||
+ | CopyHelper provides a convenient means of copying DataObjects. | ||
+ | <source lang="java"> | ||
+ | CopyHelper copyHelper = helperContext.getCopyyHelper(); | ||
+ | </source> | ||
+ | |||
+ | ===Shallow Copy=== | ||
+ | Create a new DataObject containing the values of all dataType=true properties (excluding the ChangeSummary property). | ||
+ | <source lang="java"> | ||
+ | DataObject shallowCopy = copyHelper.copyShallow(dataObject); | ||
+ | </source> | ||
+ | |||
+ | ===Deep Copy=== | ||
+ | Create a copy of the entire tree. | ||
+ | <source lang="java"> | ||
+ | DataObject deepCopy = copyHelper.copy(dataObject); | ||
+ | </source> | ||
==EqualityHelper - Compare DataObjects== | ==EqualityHelper - Compare DataObjects== |
Revision as of 15:45, 25 February 2009
Contents
HelperContext
TypeHelper - Access Metadata
XSDHelper - Access XML Schema Metadata
DataFactory - Create DataObjects
DataHelper - Convert Simple Values
XMLHelper - Handle XML Data as DataObjects
CopyHelper - Create Copies of DataObjects
CopyHelper provides a convenient means of copying DataObjects.
CopyHelper copyHelper = helperContext.getCopyyHelper();
Shallow Copy
Create a new DataObject containing the values of all dataType=true properties (excluding the ChangeSummary property).
DataObject shallowCopy = copyHelper.copyShallow(dataObject);
Deep Copy
Create a copy of the entire tree.
DataObject deepCopy = copyHelper.copy(dataObject);
EqualityHelper - Compare DataObjects
EqualityHelper provides a convenient means of comparing DataObjects.
EqualityHelper equalityHelper = helperContext.getEqualityHelper();
Shallow Equal
Two DataObjects are considered shallow equal if the data objects are of the same type and all the values of all dataType=true properties (excluding the ChangeSummary property) are equal.
boolean isShallowEqual = equalityHelper.equalShallow(dataObject1, dataObject2);
Deep Equal
Two DataObjects are considered deep equal if the data objects and the trees that they belong to are both equal.
boolean isDeepEqual = equalityHelper.equal(dataObject1, dataObject2);