I cant seem to find a "clone" method on classes that have been generated for my models in studio. What is the best way to shallow and deep copy?
MyModel clonedModel = (MyModel) JAXBUtil.clone(model);
there is a bunch of methods in platform to do that although they all down to marshal/unmarshal operations
Need to note that JAXBUtil.clone() doesn't copy sysIds fields.
So in some cases it cannot be used.
What is the oldest version of platform that the clone method can be used with and when was it released?
Here is what i had come up with for a deep copy.
private MyModel deepCopyMyModel(MyModel old) {
JSONObject json = old.toJSONObject();
MyModel returnVal = Model.fromJSONObject(json, MyModel.class);
return returnVal;
}
This JSON marshall/unmarshall works on individual Child Models (OrderLine, ReceiptLine, etc). JAXB/XML fails on individual Child Models.