Class DefaultJsonConverter

  • All Implemented Interfaces:
    JsonConverter

    public class DefaultJsonConverter
    extends java.lang.Object
    implements JsonConverter

    Default eventbus object converter

    The serialization strategy is:

    • For primitive types (String, Number and Boolean), return as is
    • For arrays, convert to JsonArray
    • Otherwise, convert to a JsonObject with the class name in the "class" attribute and the serialized form with Jackson in the "value" attribute. The (de)serialization Jackson process can be customized using the addMixIn(target, mixinSource) method
    Since:
    1.1.0
    Author:
    Michael Remond
    • Constructor Detail

      • DefaultJsonConverter

        public DefaultJsonConverter()
    • Method Detail

      • encodeObject

        public java.lang.Object encodeObject​(java.lang.Object value)
        Description copied from interface: JsonConverter
        Encode the given object in a compatible form for the event bus.
        Specified by:
        encodeObject in interface JsonConverter
        Parameters:
        value - the value to encode
        Returns:
        the encoded object
      • decodeObject

        public java.lang.Object decodeObject​(java.lang.Object value)
        Description copied from interface: JsonConverter
        Decode the given object encoded with the encodeObject method.
        Specified by:
        decodeObject in interface JsonConverter
        Parameters:
        value - the value to decode
        Returns:
        the decoded object