public final class JacksonMcpJsonMapper extends java.lang.Object implements McpJsonMapper
| 构造器和说明 |
|---|
JacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper.
|
| 限定符和类型 | 方法和说明 |
|---|---|
<T> T |
convertValue(java.lang.Object fromValue,
java.lang.Class<T> type)
Convert a value to a given type, useful for mapping nested JSON structures.
|
<T> T |
convertValue(java.lang.Object fromValue,
TypeRef<T> type)
Convert a value to a given parameterized type.
|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the underlying Jackson
ObjectMapper used for JSON serialization and
deserialization. |
<T> T |
readValue(byte[] content,
java.lang.Class<T> type)
Deserialize JSON bytes into a target type.
|
<T> T |
readValue(byte[] content,
TypeRef<T> type)
Deserialize JSON bytes into a parameterized target type.
|
<T> T |
readValue(java.lang.String content,
java.lang.Class<T> type)
Deserialize JSON string into a target type.
|
<T> T |
readValue(java.lang.String content,
TypeRef<T> type)
Deserialize JSON string into a parameterized target type.
|
byte[] |
writeValueAsBytes(java.lang.Object value)
Serialize an object to JSON bytes.
|
java.lang.String |
writeValueAsString(java.lang.Object value)
Serialize an object to JSON string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDefault, getDefaultpublic JacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper - the ObjectMapper to be used for JSON serialization and
deserialization. Must not be null.java.lang.IllegalArgumentException - if the provided ObjectMapper is null.public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
ObjectMapper used for JSON serialization and
deserialization.public <T> T readValue(java.lang.String content,
java.lang.Class<T> type)
throws java.io.IOException
McpJsonMapperreadValue 在接口中 McpJsonMapperT - generic typecontent - JSON as Stringtype - target classjava.io.IOException - on parse errorspublic <T> T readValue(byte[] content,
java.lang.Class<T> type)
throws java.io.IOException
McpJsonMapperreadValue 在接口中 McpJsonMapperT - generic typecontent - JSON as bytestype - target classjava.io.IOException - on parse errorspublic <T> T readValue(java.lang.String content,
TypeRef<T> type)
throws java.io.IOException
McpJsonMapperreadValue 在接口中 McpJsonMapperT - generic typecontent - JSON as Stringtype - parameterized type referencejava.io.IOException - on parse errorspublic <T> T readValue(byte[] content,
TypeRef<T> type)
throws java.io.IOException
McpJsonMapperreadValue 在接口中 McpJsonMapperT - generic typecontent - JSON as bytestype - parameterized type referencejava.io.IOException - on parse errorspublic <T> T convertValue(java.lang.Object fromValue,
java.lang.Class<T> type)
McpJsonMapperconvertValue 在接口中 McpJsonMapperT - generic typefromValue - source valuetype - target classpublic <T> T convertValue(java.lang.Object fromValue,
TypeRef<T> type)
McpJsonMapperconvertValue 在接口中 McpJsonMapperT - generic typefromValue - source valuetype - target type referencepublic java.lang.String writeValueAsString(java.lang.Object value)
throws java.io.IOException
McpJsonMapperwriteValueAsString 在接口中 McpJsonMappervalue - object to serializejava.io.IOException - on serialization errorspublic byte[] writeValueAsBytes(java.lang.Object value)
throws java.io.IOException
McpJsonMapperwriteValueAsBytes 在接口中 McpJsonMappervalue - object to serializejava.io.IOException - on serialization errors