Class JsiiObjectMapper

java.lang.Object
software.amazon.jsii.JsiiObjectMapper

@Internal public final class JsiiObjectMapper extends Object
Provides a correctly configured JSON processor for handling JSII requests and responses.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.fasterxml.jackson.databind.ObjectMapper
    An ObjectMapper that can be used to serialize and deserialize JSII requests and responses.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    treeToValue(com.fasterxml.jackson.databind.JsonNode tree, NativeType<T> valueType)
    Similar to calling JsiiObjectMapper.INSTANCE.treeToValue, but handles a null JsonNode argument well, and throws JsiiError instead of JsonProcessingException.
    static <T extends com.fasterxml.jackson.databind.JsonNode>
    T
    Similar to calling JsiiObjectMapper.INSTANCE.valueToTree, but handles a null argument well by returning null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INSTANCE

      public static final com.fasterxml.jackson.databind.ObjectMapper INSTANCE
      An ObjectMapper that can be used to serialize and deserialize JSII requests and responses.
  • Method Details

    • treeToValue

      public static <T> T treeToValue(com.fasterxml.jackson.databind.JsonNode tree, NativeType<T> valueType)
      Similar to calling JsiiObjectMapper.INSTANCE.treeToValue, but handles a null JsonNode argument well, and throws JsiiError instead of JsonProcessingException.
      Type Parameters:
      T - expected type
      Parameters:
      tree - the JSON object to parse
      valueType - the expected type value type
      Returns:
      the deserialized value
    • valueToTree

      public static <T extends com.fasterxml.jackson.databind.JsonNode> T valueToTree(Object value)
      Similar to calling JsiiObjectMapper.INSTANCE.valueToTree, but handles a null argument well by returning null.
      Type Parameters:
      T - expected JSON type
      Parameters:
      value - the value to serialize
      Returns:
      the JSON object