2. Does cast create objects, even if there are the
underlying data already has a DataObject in the context?
Is C1.cast(C2.cast(O1)) == O1? Yes
3. How is the value of O2.getChangeSummary() related to
the value of O1.getChangeSummary()?
- O1.getChangeSummary().isLogging() ==
O2.getChangeSummary().isLogging()
- O1.getChangeSummary().getOldSequence(aDataObject) ==
O2.getChangeSummary().getOldSequence(aDataObject)
Note identity might be
too strong a requirement here, the returned Sequence may only need to be
equivalent.
- O1.getChangeSummary().getOldValue(aContext1Property) ==
O2.getChangeSummary().getOldValue(theCorrespondingContext2Property)
Note
that although the dataType=true properties would be identical, the
dataType=false propertie values would be the equivalent from the other
HelperContext.
- O1.getChangeSummary().getOldValues(aDataObject) ==
O2.getChangeSummary().getOldValues(aDataObject)
- O1.getChangeSummary().isCreated(aContext1DataObject) ==
O2.getChangeSummary().isCreated(theCorrespondingContext2DataObject)
- O1.getChangeSummary().isModified(aContext1DataObject) ==
O2.getChangeSummary().isModified(theCorrespondingContext2DataObject)
- O1.getChangeSummary().isDeleted(aContext1DataObject) ==
O2.getChangeSummary().isDeleted(theCorrespondingContext2DataObject)
- O1.getChangeSummary().getDataGraph() !=
O2.getChangeSummary().getDataGraph()
- O1.getChangeSummary().getRootObject() !=
O2.getChangeSummary().getRootObject()
- O1.getChangeSummary().getOldContainer(aDataObject) !=
O2.getChangeSummary().getOldContainer(aDataObject)
- O1.getChangeSummary().getOldContainmentProperty(aDataObject) !=
O2.getChangeSummary().getOldContainmentProperty(aDataObject)
---
For the following:
1. What is the state of O1 after casting to
O2?
c) We say that the state of O1 is undefined. In
order to "reactivate" O1, we would have to cast it back from O2, that is
we would have to
explicitly say O1=C1.cast(O2), which would make O2
invalid, but bring O1 back into a valid and consistant state.
I agree with Frank that simply changing the DataObject's Type is
another way to move a DataObject from one HelperContext to another. I
wouldn't categorize this as a cast though, and if this became our
agreed upon approach I would suggest a different API such as "move" or "adopt"
(from DOM APIs). Also instead of stating that the state of O1 being
undefined, I would state that C2.cast(O1) would cause the following operation to
happen (O1.detach).
---
Role of the Cast Operation (Motivation)
Moving Between Helper Contexts
A cast/move operation appears necessary to move DataObjects from one
HelperContext to another.
Applying Containment Information
"on-the-fly"
A cast/move operation as a mechanism to apply containment information for
the purposes of mapping a DataObject to XML is too cumbersome as it
requires many changes on the DataObject before the
XML marshalling/unmarshalling operation can take place. Compare this
with a object-to-XML mapping tool such as MOXy which is part of EclipseLink
(Eclipse Persistence Services) project which can apply many XML mappings to
an object without any modifications to that object.
---
DataObject cast(Object object)
In my opinion:
The ability to cast Objects other than DataObjects is a possible next step,
but I feel should be discussed in detail on its own before changing the proposed
cast API.