schultek/stormberry

Default enum serialization

TimWhiting opened this issue · 1 comments

Default enum serialization would be good. It could maybe be configurable via the annotation, but I think a sensible default is to use the .name getter on enums and the EnumType.values.byName(stringToParse) static method to serialize it to/from strings. This way adding / removing enums is non-breaking. (Using the index would be breaking). However this means that changing the name is breaking. Which is why it might be good to make it configurable.

Maybe we can generate some default TypeConverters for each used enum. The user can then customize the behaviour by defining an own custom TypeConverter that would then override the default one.
This way we don't need any extra annotations.