Modified Serialization and Deserialization
This example demonstrates the modified serialization and deserialization
of objects.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
Using the identity transformation ID ,
objects in two classes are serialized to asXML
and to asJSON , and then
deserialized.
The object in the class cl_unsafe is processed in the standard
way. The example shows that the standard behavior permits an object in a
class to be created for which a private attribute is given a value set
from outside, both for asXML and for asJSON After
deserialization, the value of the private attribute attr in the
new class does not match the value defined in the class.
The object in the class cl_safe is modified before being
processed. The example shows demonstrates how the methods
SERIALIZE_HELPER and DESERIALIZE_HELPER can be used to avoid
an undesirable manipulation of attributes. The private attribute
attr is serialized using SERIALIZE_HELPER but is not
deserialized in DESERIALIZE_HELPER .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved