microstream
microstream copied to clipboard
Value Initializer similar to Value Translator
To translate values from a legacy type instance to a current type instance, value translators with arbitrary logic can be defined. However, for newly added fields, no comparable logic can be defined. Currently, they are forced to remain 0 (0 / 0.0 / false / null), even if they are final fields. One option to initialize their values is to use custom instantiators (see Issue microstream-one/microstream-public#8). However, that is not a full-fledged replacement:
- Constructors might contain logic that shall not be executed by the process of restoring previously stored instances.
- Instances might already exist but shall be updated from the persisted record.
Hence, a mechanism of "ValueInitializer"s similar to the existing "ValueTranslator"s is required.