public interface McpJsonMapper
| 限定符和类型 | 方法和说明 |
|---|---|
<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.
|
static McpJsonMapper |
createDefault()
Creates a new default
McpJsonMapper. |
static McpJsonMapper |
getDefault()
Returns the default
McpJsonMapper. |
<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.
|
<T> T readValue(java.lang.String content,
java.lang.Class<T> type)
throws java.io.IOException
T - generic typecontent - JSON as Stringtype - target classjava.io.IOException - on parse errors<T> T readValue(byte[] content,
java.lang.Class<T> type)
throws java.io.IOException
T - generic typecontent - JSON as bytestype - target classjava.io.IOException - on parse errors<T> T readValue(java.lang.String content,
TypeRef<T> type)
throws java.io.IOException
T - generic typecontent - JSON as Stringtype - parameterized type referencejava.io.IOException - on parse errors<T> T readValue(byte[] content,
TypeRef<T> type)
throws java.io.IOException
T - generic typecontent - JSON as bytestype - parameterized type referencejava.io.IOException - on parse errors<T> T convertValue(java.lang.Object fromValue,
java.lang.Class<T> type)
T - generic typefromValue - source valuetype - target class<T> T convertValue(java.lang.Object fromValue,
TypeRef<T> type)
T - generic typefromValue - source valuetype - target type referencejava.lang.String writeValueAsString(java.lang.Object value)
throws java.io.IOException
value - object to serializejava.io.IOException - on serialization errorsbyte[] writeValueAsBytes(java.lang.Object value)
throws java.io.IOException
value - object to serializejava.io.IOException - on serialization errorsstatic McpJsonMapper getDefault()
McpJsonMapper.McpJsonMapperjava.lang.IllegalStateException - If no McpJsonMapper implementation exists on
the classpath.static McpJsonMapper createDefault()
McpJsonMapper.McpJsonMapperjava.lang.IllegalStateException - If no McpJsonMapper implementation exists on
the classpath.