Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
NetworkMessage instances can be (de-)serialized using instances of MessageSerializer and MessageDeserializer interfaces. These interfaces have to be implemented for every message type which is very tedious and can be automated. It is proposed to use annotation processing to generate the corresponding implementations for every network message.
Current serialization procedure looks like the following:
- Message header is written.
- Message fields are sorted alphanumerically. This is done for historical reasons and not needed at the moment, but it was decided to keep this logic.
- Message fields are dumped into the provided stateful MessageWriter.
De-serialization procedure performs the same actions in reverse order.
Requirements
- Create an annotation processor for generating instances of the following interfaces:
- MessageDeserializer
- MessageSerializer
- MessageSerializationFactory
- Introduce the @AutoSerializable annotation that will be used to mark NetworkMessage implementations which will be considered as candidates for code generation by the annotation processor.
- It should be possible to implement custom (de-)serializers for some messages. In this case it is proposed to simply omit the @AutoSerializable annotation on such messages.
- Auto-generated MessageSerializationFactory instances should be automatically registered in a MessageSerializationRegistry. It is proposed to create a helper class that will add the generated factories to the provided registry.
Attachments
Issue Links
- links to