The compiler offers two mechanisms to control whether a property is streamed using a streaming mechanism, such as the one implemented in the classes unit. These mechanisms write extra information to the generated RTTI, which is later used in the streaming system:
These two specifiers can both be evaluated to decide whether a property must be streamed, and they are independent of each other.
The argument to the stored specifier should be either a boolean constant, a boolean field of the class, or a parameterless function which returns a boolean result. If the argument of the stored specifier evaluates to False, the property will not be streamed.
Remark Absence of a stored specifier is equivalent to stored True.
If the evaluation of Stored resulted in True, the default for a property is considered:
The default specifier can be specified for ordinal types and sets. properties that have as value this default value, will not be written to the stream by the streaming system, even if Stored was True. The default value is stored in the RTTI that is generated for the class.
String, floating-point and pointer properties have implicit default value of empty string, 0 or nil, respectively. Ordinal and set properties have no implicit default value.
The nodefault specifier (nodefault) must be used to indicate that a property has no default value. The effect is that the value of this property is always written to the stream when streaming the property, if stored was True.