public class MessageTypeAdapter extends com.google.gson.TypeAdapter<Message>
RequestMessage,
ResponseMessage, and NotificationMessage.| Modifier and Type | Class and Description |
|---|---|
static class |
MessageTypeAdapter.Factory |
| Constructor and Description |
|---|
MessageTypeAdapter(MessageJsonHandler handler,
com.google.gson.Gson gson) |
| Modifier and Type | Method and Description |
|---|---|
protected Message |
createMessage(java.lang.String jsonrpc,
Either<java.lang.String,java.lang.Number> id,
java.lang.String method,
java.lang.Object params,
java.lang.Object responseResult,
ResponseError responseError) |
protected java.lang.Object |
fromJson(com.google.gson.JsonElement element,
java.lang.reflect.Type type) |
protected java.lang.Object |
fromJson(com.google.gson.stream.JsonReader in,
java.lang.reflect.Type type) |
protected java.lang.reflect.Type[] |
getParameterTypes(java.lang.String method) |
protected boolean |
isNull(java.lang.Object value) |
protected boolean |
isNullOrVoidType(java.lang.reflect.Type type) |
protected java.lang.Object |
parseParams(com.google.gson.stream.JsonReader in,
java.lang.String method)
Convert the json input into the parameters object corresponding to the call
made by method.
|
protected java.lang.Object |
parseParams(java.lang.Object params,
java.lang.String method)
Convert the JsonElement into the parameters object corresponding to the call made
by method.
|
protected java.lang.Object |
parseResult(com.google.gson.stream.JsonReader in,
java.lang.String id)
Convert the json input into the result object corresponding to the call made
by id.
|
protected java.lang.Object |
parseResult(java.lang.Object result,
java.lang.String id)
Convert the JsonElement into the result object corresponding to the call made
by id.
|
Message |
read(com.google.gson.stream.JsonReader in) |
void |
write(com.google.gson.stream.JsonWriter out,
Message message) |
protected void |
writeId(com.google.gson.stream.JsonWriter out,
Either<java.lang.String,java.lang.Number> id) |
protected void |
writeNullValue(com.google.gson.stream.JsonWriter out)
Use this method to write a
null value even if the JSON writer is set to not serialize null. |
public MessageTypeAdapter(MessageJsonHandler handler, com.google.gson.Gson gson)
public Message read(com.google.gson.stream.JsonReader in) throws java.io.IOException, com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException
read in class com.google.gson.TypeAdapter<Message>java.io.IOExceptioncom.google.gson.JsonIOExceptioncom.google.gson.JsonSyntaxExceptionprotected java.lang.Object parseResult(com.google.gson.stream.JsonReader in,
java.lang.String id)
throws com.google.gson.JsonIOException,
com.google.gson.JsonSyntaxException
parseResult(Object, String) on the return value of this call for a
second chance conversion.in - json input to read fromid - id of request message this is in response tocom.google.gson.JsonIOExceptioncom.google.gson.JsonSyntaxExceptionprotected java.lang.Object parseResult(java.lang.Object result,
java.lang.String id)
throws com.google.gson.JsonSyntaxException
result - json element to read fromid - id of request message this is in response tocom.google.gson.JsonSyntaxExceptionprotected java.lang.Object parseParams(com.google.gson.stream.JsonReader in,
java.lang.String method)
throws java.io.IOException,
com.google.gson.JsonIOException
parseParams(Object, String) on the return value of this call for a
second chance conversion.in - json input to read frommethod - method name of requestjava.io.IOExceptioncom.google.gson.JsonIOExceptionprotected java.lang.Object parseParams(java.lang.Object params,
java.lang.String method)
params - json element to read frommethod - method name of requestprotected java.lang.Object fromJson(com.google.gson.stream.JsonReader in,
java.lang.reflect.Type type)
throws com.google.gson.JsonIOException
com.google.gson.JsonIOExceptionprotected java.lang.Object fromJson(com.google.gson.JsonElement element,
java.lang.reflect.Type type)
protected boolean isNull(java.lang.Object value)
protected boolean isNullOrVoidType(java.lang.reflect.Type type)
protected java.lang.reflect.Type[] getParameterTypes(java.lang.String method)
protected Message createMessage(java.lang.String jsonrpc, Either<java.lang.String,java.lang.Number> id, java.lang.String method, java.lang.Object params, java.lang.Object responseResult, ResponseError responseError) throws com.google.gson.JsonParseException
com.google.gson.JsonParseExceptionpublic void write(com.google.gson.stream.JsonWriter out,
Message message)
throws java.io.IOException
write in class com.google.gson.TypeAdapter<Message>java.io.IOExceptionprotected void writeId(com.google.gson.stream.JsonWriter out,
Either<java.lang.String,java.lang.Number> id)
throws java.io.IOException
java.io.IOExceptionprotected void writeNullValue(com.google.gson.stream.JsonWriter out)
throws java.io.IOException
null value even if the JSON writer is set to not serialize null.java.io.IOException