setPropertyFromObjectIfNotDefault method
void
setPropertyFromObjectIfNotDefault(
- String property,
- ISerialisable defaultValue,
- ISerialisable? value
Set property from serialisable of value is not equal to the default value.
- This is useful for preventing default state from bloating saved JSON models.
- Object must implement == as value equality .
Implementation
void setPropertyFromObjectIfNotDefault(String property, ISerialisable defaultValue, ISerialisable? value)
{
if (value != null &&
value != defaultValue) {
setPropertyUnsafe(property, new MarshalledObject.marshal(value).getRawValue() );
}
else {
removeProperty(property);
}
}