I have a thrift file to define data schemas and from the java class is auto generated. I am starting to see some issues with the union type objects in the way they are deserialized so I want to enforce anyone who adds a union type object to also add a deserializer. I am not entirely sure what kind of pattern I am looking for to achieve the solution. Can anyone help me with some pointers to start?
Some solutions that I thought of
-
whenever a java class is generated – ensure in the generation code itself that a deserializer method has to be implemented, or
-
during the compile time ensure that each union type object has a deserializer
I can think of some solutions but have never worked with auto generated classes at this level. So want some guidance to start and I can ask better questions then 🙂