Class JacksonMcpJsonMapper

java.lang.Object
io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapper
All Implemented Interfaces:
McpJsonMapper

@Deprecated(forRemoval=true, since="18.0.0") public final class JacksonMcpJsonMapper extends Object implements McpJsonMapper
Deprecated, for removal: This API element is subject to removal in a future version.
since 18.0.0, use JacksonMcpJsonMapper instead. Will be removed in 19.0.0
Jackson-based implementation of JsonMapper. Wraps a Jackson ObjectMapper but keeps the SDK decoupled from Jackson at the API level.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    convertValue(Object fromValue, TypeRef<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    convertValue(Object fromValue, Class<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    com.fasterxml.jackson.databind.ObjectMapper
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the underlying Jackson ObjectMapper used for JSON serialization and deserialization.
    <T> T
    readValue(byte[] content, TypeRef<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    readValue(byte[] content, Class<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    readValue(String content, TypeRef<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    readValue(String content, Class<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    byte[]
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

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

    • JacksonMcpJsonMapper

      public JacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper.
      Parameters:
      objectMapper - the ObjectMapper to be used for JSON serialization and deserialization. Must not be null.
      Throws:
      IllegalArgumentException - if the provided ObjectMapper is null.
  • Method Details

    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the underlying Jackson ObjectMapper used for JSON serialization and deserialization.
      Returns:
      the ObjectMapper instance
    • readValue

      public <T> T readValue(String content, Class<T> type) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      readValue in interface McpJsonMapper
      Throws:
      IOException
    • readValue

      public <T> T readValue(byte[] content, Class<T> type) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      readValue in interface McpJsonMapper
      Throws:
      IOException
    • readValue

      public <T> T readValue(String content, TypeRef<T> type) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      readValue in interface McpJsonMapper
      Throws:
      IOException
    • readValue

      public <T> T readValue(byte[] content, TypeRef<T> type) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      readValue in interface McpJsonMapper
      Throws:
      IOException
    • convertValue

      public <T> T convertValue(Object fromValue, Class<T> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      convertValue in interface McpJsonMapper
    • convertValue

      public <T> T convertValue(Object fromValue, TypeRef<T> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      convertValue in interface McpJsonMapper
    • writeValueAsString

      public String writeValueAsString(Object value) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      writeValueAsString in interface McpJsonMapper
      Throws:
      IOException
    • writeValueAsBytes

      public byte[] writeValueAsBytes(Object value) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      writeValueAsBytes in interface McpJsonMapper
      Throws:
      IOException