matlab.serialization.ElementSerializationContent Class
Namespace: matlab.serialization
Superclasses: matlab.mixin.CustomDisplay
, matlab.mixin.indexing.RedefinesDot
, handle
Description
A matlab.serialization.ElementSerializationContent
instance represents an
object to be serialized or deserialized.
matlab.serialization.ElementSerializationContent
implements methods that add,
remove, or change the properties that are saved or loaded.
The matlab.serialization.ElementSerializationContent
class is a handle
class.
Creation
matlab.serialization.ElementSerializationContent
objects are created by the
modifyOutgoingSerializationContent
and
modifyIncomingSerializationContent
methods of matlab.mixin.CustomElementSerialization
. You cannot instantiate
matlab.serialization.ElementSerializationContent
directly.
Methods
Examples
Tips
If you need to customize a superclass private property from the serialization methods of one of its subclasses, use the fully qualified
className.propName
syntax. For example,subclassA
inherits fromsuperclassA
, andsuperclassA
defines a private property namedprivProp
. Use the fully qualified syntax to referenceprivProp
fromsubclasssA
serialization methods.classdef subclassA < superclassA properties prop1 end methods (Static) function modifyOutgoingSerializationContent(sObj,obj) % Access the superclass private property privProp x = sObj.getValue("superclassA.privProp"); % Access the sublcass property prop1 y = sObj.getValue("prop1"); ... end end end
You can use dot notation in place of explicitly using the
getValue
andupdateValue
methods. For example, these two syntaxes are equivalent.x = sObj.getValue("prop1") x = sObj.prop1
You cannot use dot notation when accessing a private property of a superclass. Use the explicit methods instead.
Version History
Introduced in R2024b