XStream & # 8596; Alternative binary formats (e.g. protocol buffers)

We are currently using XStream to encode the input / output of web services in XML. However, we are considering the possibility of switching to a binary format with a code generator for several languages ​​(protobuf, Thrift, Hessian, etc.), in order to simplify and facilitate support for new clients in manual coding (also for better support for message formats that include binary data) .

However, most of our objects on the server are POJOs with XStream that handle serialization through reflection and annotations, and most of these libraries assume that they will generate the POJOs themselves. I can come up with several ways to interact with an alternative library:

  • Write an XStream marshaler for the target format.

  • Write your own code to marshal POJOs to / from classes generated by the alternative library.

  • A subclass of generated classes for implementing POJO logic. Rewriting may be required. (Also I mentioned that we want to use Terracotta?)

  • Use another library that supports both reflection (for example, XStream) and code generation.

However, I'm not sure if the serialization library is best suited for the above methods.

+3
source share
1 answer

(1) , API, , / .

(2), , : https://github.com/eishay/jvm-serializers/wiki/ToolBehavior ( ). , , , : https://github.com/eishay/jvm-serializers/wiki

, / POJO. , POJO , .

(3) ( ). - .

(4) ( ) "" , , , POJO . , POJO , .

Protostuff , , Java.

+1

Source: https://habr.com/ru/post/1737199/


All Articles