Class JsonNodeToByteArrayConverter

java.lang.Object
org.axonframework.serialization.jackson3.JsonNodeToByteArrayConverter
All Implemented Interfaces:
ContentTypeConverter<tools.jackson.databind.JsonNode,byte[]>

public class JsonNodeToByteArrayConverter extends Object implements ContentTypeConverter<tools.jackson.databind.JsonNode,byte[]>
ContentTypeConverter implementation for Jackson 3 that converts a JsonNode object into a byte[]. The byte[] will contain the UTF8 encoded JSON string.
Since:
4.13.0
Author:
Allard Buijze, John Hendrikx
  • Constructor Details

    • JsonNodeToByteArrayConverter

      public JsonNodeToByteArrayConverter(tools.jackson.databind.ObjectMapper objectMapper)
      Initialize the converter, using given objectMapper to convert the JSonNode into bytes. Typically, this would be the objectMapper used by the Serializer that serializes objects into JsonNode.
      Parameters:
      objectMapper - The objectMapper to serialize the JsonNode with.
  • Method Details

    • expectedSourceType

      public Class<tools.jackson.databind.JsonNode> expectedSourceType()
      Description copied from interface: ContentTypeConverter
      The expected type of input data.
      Specified by:
      expectedSourceType in interface ContentTypeConverter<tools.jackson.databind.JsonNode,byte[]>
      Returns:
      the expected data format in IntermediateRepresentation
    • targetType

      public Class<byte[]> targetType()
      Description copied from interface: ContentTypeConverter
      The returned type of IntermediateRepresentation
      Specified by:
      targetType in interface ContentTypeConverter<tools.jackson.databind.JsonNode,byte[]>
      Returns:
      the output data format in IntermediateRepresentation
    • convert

      public byte[] convert(tools.jackson.databind.JsonNode original)
      Description copied from interface: ContentTypeConverter
      Converts the given object into another. Typically, these values are contained by a SerializedObject instance.
      Specified by:
      convert in interface ContentTypeConverter<tools.jackson.databind.JsonNode,byte[]>
      Parameters:
      original - the value to convert
      Returns:
      the converted value