Package com.rabbitmq.tools.jsonrpc
Class JacksonJsonRpcMapper
- java.lang.Object
-
- com.rabbitmq.tools.jsonrpc.JacksonJsonRpcMapper
-
- All Implemented Interfaces:
JsonRpcMapper
public class JacksonJsonRpcMapper extends Object implements JsonRpcMapper
JsonRpcMapper
based on Jackson.Uses the streaming and databind modules. You need to add the appropriate dependency to the classpath if you want to use this class, as the RabbitMQ Java client library does not pull Jackson automatically when using a dependency management tool like Maven or Gradle.
Make sure to use the latest version of the Jackson library, as the version used in the RabbitMQ Java client can be a little bit behind.
- Since:
- 4.8.0
- See Also:
JsonRpcMapper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.rabbitmq.tools.jsonrpc.JsonRpcMapper
JsonRpcMapper.JsonRpcRequest, JsonRpcMapper.JsonRpcResponse
-
-
Constructor Summary
Constructors Constructor Description JacksonJsonRpcMapper()
JacksonJsonRpcMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
convert(com.fasterxml.jackson.core.TreeNode node, Class<?> expectedType)
JsonRpcMapper.JsonRpcRequest
parse(String requestBody, ServiceDescription description)
Parses a JSON RPC request.JsonRpcMapper.JsonRpcResponse
parse(String responseBody, Class<?> expectedReturnType)
Parses a JSON RPC response.String
write(Object input)
Serialize an object into JSON.
-
-
-
Method Detail
-
parse
public JsonRpcMapper.JsonRpcRequest parse(String requestBody, ServiceDescription description)
Description copied from interface:JsonRpcMapper
Parses a JSON RPC request. TheServiceDescription
can be used to look up the invoked procedure and learn about its signature.- Specified by:
parse
in interfaceJsonRpcMapper
- Returns:
-
parse
public JsonRpcMapper.JsonRpcResponse parse(String responseBody, Class<?> expectedReturnType)
Description copied from interface:JsonRpcMapper
Parses a JSON RPC response.- Specified by:
parse
in interfaceJsonRpcMapper
- Returns:
-
write
public String write(Object input)
Description copied from interface:JsonRpcMapper
Serialize an object into JSON.- Specified by:
write
in interfaceJsonRpcMapper
- Returns:
-
convert
protected Object convert(com.fasterxml.jackson.core.TreeNode node, Class<?> expectedType) throws IOException
- Throws:
IOException
-
-