Class JsonNodeToByteArrayConverter
java.lang.Object
org.axonframework.serialization.json.JsonNodeToByteArrayConverter
- All Implemented Interfaces:
ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]>
public class JsonNodeToByteArrayConverter
extends Object
implements ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]>
ContentTypeConverter implementation for Jackson 2 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
ConstructorsConstructorDescriptionJsonNodeToByteArrayConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Initialize the converter, using givenobjectMapperto convert the JSonNode into bytes. -
Method Summary
-
Constructor Details
-
JsonNodeToByteArrayConverter
public JsonNodeToByteArrayConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Initialize the converter, using givenobjectMapperto 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
Description copied from interface:ContentTypeConverterThe expected type of input data.- Specified by:
expectedSourceTypein interfaceContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]> - Returns:
- the expected data format in IntermediateRepresentation
-
targetType
Description copied from interface:ContentTypeConverterThe returned type of IntermediateRepresentation- Specified by:
targetTypein interfaceContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]> - Returns:
- the output data format in IntermediateRepresentation
-
convert
public byte[] convert(com.fasterxml.jackson.databind.JsonNode original) Description copied from interface:ContentTypeConverterConverts the given object into another. Typically, these values are contained by aSerializedObjectinstance.- Specified by:
convertin interfaceContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,byte[]> - Parameters:
original- the value to convert- Returns:
- the converted value
-