if true
, the codec will also not emit the _case
field during writing of default
case class/object (analogous to transientDefault).
if true
, the codec will also not emit the _case
field during writing of default
case class/object (analogous to transientDefault).
When materializing a
GenCodec
for sealed hierarchy with@flatten
annotation, you can use this annotation on one of case classes or objects to mark it as the default one. If during deserialization the codec is unable to find the_case
field and determine the case class/object to deserialize, it will try to deserialize the data to the class/object marked with this annotation.This is useful for retaining backwards compatibility with serialized format when refactoring code and replacing a simple case class with a sealed hierarchy.