org.axonframework.serializer.json
Class JsonNodeToByteArrayConverter

java.lang.Object
  extended by org.axonframework.serializer.AbstractContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]>
      extended by org.axonframework.serializer.json.JsonNodeToByteArrayConverter
All Implemented Interfaces:
ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]>

public class JsonNodeToByteArrayConverter
extends AbstractContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]>

ContentTypeConverter implementation that converts a JsonNode object into a byte[]. The byte[] will contain the UTF8 encoded JSON string.

Since:
2.2
Author:
Allard Buijze

Constructor Summary
JsonNodeToByteArrayConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
          Initialize the converter, using given objectMapper to convert the JSonNode into bytes.
 
Method Summary
 byte[] convert(com.fasterxml.jackson.databind.JsonNode original)
          Converts the given object into another.
 Class<com.fasterxml.jackson.databind.JsonNode> expectedSourceType()
          The expected type of input data.
 Class<byte[]> targetType()
          The returned type of IntermediateRepresentation
 
Methods inherited from class org.axonframework.serializer.AbstractContentTypeConverter
convert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonNodeToByteArrayConverter

public JsonNodeToByteArrayConverter(com.fasterxml.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 Detail

expectedSourceType

public Class<com.fasterxml.jackson.databind.JsonNode> expectedSourceType()
Description copied from interface: ContentTypeConverter
The expected type of input data.

Returns:
the expected data format in IntermediateRepresentation

targetType

public Class<byte[]> targetType()
Description copied from interface: ContentTypeConverter
The returned type of IntermediateRepresentation

Returns:
the output data format in IntermediateRepresentation

convert

public byte[] convert(com.fasterxml.jackson.databind.JsonNode original)
Description copied from interface: ContentTypeConverter
Converts the given object into another. Typically, these values are contained by a SerializedObject instance.

Parameters:
original - the value to convert
Returns:
the converted value


Copyright © 2010-2016. All Rights Reserved.