public class MessageJsonHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static JsonRpcMethod |
CANCEL_METHOD |
Constructor and Description |
---|
MessageJsonHandler(java.util.Map<java.lang.String,JsonRpcMethod> supportedMethods) |
MessageJsonHandler(java.util.Map<java.lang.String,JsonRpcMethod> supportedMethods,
java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson) |
Modifier and Type | Method and Description |
---|---|
com.google.gson.GsonBuilder |
getDefaultGsonBuilder()
Create a
GsonBuilder with default settings for parsing JSON-RPC messages. |
com.google.gson.Gson |
getGson() |
JsonRpcMethod |
getJsonRpcMethod(java.lang.String name)
Resolve an RPC method by name.
|
MethodProvider |
getMethodProvider() |
Message |
parseMessage(java.lang.CharSequence input) |
Message |
parseMessage(java.io.Reader input) |
java.lang.String |
serialize(Message message) |
void |
serialize(Message message,
java.io.Writer output) |
void |
setMethodProvider(MethodProvider methodProvider) |
static java.lang.String |
toString(java.lang.Object object)
Perform JSON serialization of the given object using the default configuration of JSON-RPC messages
enhanced with the pretty printing option.
|
public static final JsonRpcMethod CANCEL_METHOD
public MessageJsonHandler(java.util.Map<java.lang.String,JsonRpcMethod> supportedMethods)
supportedMethods
- - a map used to resolve RPC methods in getJsonRpcMethod(String)
public MessageJsonHandler(java.util.Map<java.lang.String,JsonRpcMethod> supportedMethods, java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
supportedMethods
- - a map used to resolve RPC methods in getJsonRpcMethod(String)
configureGson
- - a function that contributes to the GsonBuilder created by getDefaultGsonBuilder()
public com.google.gson.GsonBuilder getDefaultGsonBuilder()
GsonBuilder
with default settings for parsing JSON-RPC messages.public com.google.gson.Gson getGson()
public JsonRpcMethod getJsonRpcMethod(java.lang.String name)
public MethodProvider getMethodProvider()
public void setMethodProvider(MethodProvider methodProvider)
public Message parseMessage(java.lang.CharSequence input) throws com.google.gson.JsonParseException
com.google.gson.JsonParseException
public Message parseMessage(java.io.Reader input) throws com.google.gson.JsonParseException
com.google.gson.JsonParseException
public java.lang.String serialize(Message message)
public void serialize(Message message, java.io.Writer output) throws com.google.gson.JsonIOException
com.google.gson.JsonIOException
public static java.lang.String toString(java.lang.Object object)