Codec module allows to encode and decode custom objects in a fast and efficient way.
To run the examples, you need to clone ActiveJ from GitHub
And import it as a Maven project. Check out tag v4.3. Before running the examples, build the project.
These examples are located at
All of these examples utilize two utility classes. The first one is a simple POJO
Person with three values: id,
name, dateOfBirth. The second one is
Registry that contains a configured
CodecRegistry needed for encoding/decoding
In this example we encode
Person john instance to
ByteBuf and then decode it back to
Person. To perform such
operations, we first need to create a
and then use it for encode and decode operations.
This example represents how to encode/decode objects to/from JSONs:
In this example we perform encode/decode operations on a List and a Map of two
Person objects to/from JSONs: