Class JsonNodeToObjectNodeConverter

java.lang.Object
org.axonframework.conversion.json.JsonNodeToObjectNodeConverter
All Implemented Interfaces:
ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ObjectNode>

public class JsonNodeToObjectNodeConverter extends Object implements ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ObjectNode>
A ContentTypeConverter implementation that converts a JsonNode into an ObjectNode.

Intended to simplify JSON-typed event upcasters, which generally deal with an ObjectNode as the event.

Will succeed if the JsonNode has a node type of JsonNodeType.OBJECT.

Since:
4.6.0
Author:
Steven van Beelen
  • Constructor Details

    • JsonNodeToObjectNodeConverter

      public JsonNodeToObjectNodeConverter()
  • Method Details

    • expectedSourceType

      @Nonnull public Class<com.fasterxml.jackson.databind.JsonNode> expectedSourceType()
      Description copied from interface: ContentTypeConverter
      Returns the expected type of input data for this ContentTypeConverter to ContentTypeConverter.convert(Object).
      Specified by:
      expectedSourceType in interface ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ObjectNode>
      Returns:
      The expected type of input data for this ContentTypeConverter to ContentTypeConverter.convert(Object).
    • targetType

      @Nonnull public Class<com.fasterxml.jackson.databind.node.ObjectNode> targetType()
      Description copied from interface: ContentTypeConverter
      Returns the type of output for this ContentTypeConverter to ContentTypeConverter.convert(Object) into.
      Specified by:
      targetType in interface ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ObjectNode>
      Returns:
      The type of output for this ContentTypeConverter to ContentTypeConverter.convert(Object) into.
    • convert

      @Nullable public com.fasterxml.jackson.databind.node.ObjectNode convert(@Nullable com.fasterxml.jackson.databind.JsonNode input)
      Description copied from interface: ContentTypeConverter
      Converts the given input object of generic type S into an object of generic type T.
      Specified by:
      convert in interface ContentTypeConverter<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ObjectNode>
      Parameters:
      input - The object of generic type S to convert into an object of generic type T.
      Returns:
      The converted version of the given input in type T.