Corda Serialization Transform Enum Default
This annotation is used to mark an enumerated type as having had a new constant appended to it. For each additional constant added, a new annotation should be appended to the class. If more than one is required, the wrapper annotation CordaSerializationTransformEnumDefaults should be used to encapsulate them.
For example:
Enum before modification:
enum class ExampleEnum {
A, B, C
}
Assuming at some point a new constant is added, it is required we have some mechanism by which to tell nodes with an older version of the class on their Class Path what to do if they attempt to deserialize an example of the class with that new value.
@CordaSerializationTransformEnumDefault(newName = "D", oldName = "C")
enum class ExampleEnum {
A, B, C, D
}
So, on deserialisation treat any instance of the enum that is encoded as D as C.
Adding a second new constant requires the wrapper annotation CordaSerializationTransformEnumDefaults.
@CordaSerializationTransformEnumDefaults(
@CordaSerializationTransformEnumDefault(newName = "E", oldName = "D"),
@CordaSerializationTransformEnumDefault(newName = "D", oldName = "C")
)
enum class ExampleEnum {
A, B, C, D, E
}