Package io.openems.common.jsonrpc.base
Class JsonrpcResponse
- java.lang.Object
-
- io.openems.common.jsonrpc.base.JsonrpcMessage
-
- io.openems.common.jsonrpc.base.JsonrpcResponse
-
- Direct Known Subclasses:
JsonrpcResponseError
,JsonrpcResponseSuccess
public abstract class JsonrpcResponse extends JsonrpcMessage
Represents a JSON-RPC Response.{ "jsonrpc": "2.0", "id": "UUID", ... }
- See Also:
- JSON-RPC specification
-
-
Field Summary
-
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
JSONRPC_VERSION
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JsonrpcResponse(java.util.UUID id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsonrpcResponse
from(com.google.gson.JsonObject j)
Parses aJsonObject
to aJsonrpcResponse
.static JsonrpcResponse
from(java.lang.String json)
Parses a JSON String to aJsonrpcResponse
.java.util.UUID
getId()
com.google.gson.JsonObject
toJsonObject()
Gets theJsonObject
representation of thisJsonrpcMessage
.-
Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
toString
-
-
-
-
Method Detail
-
from
public static JsonrpcResponse from(java.lang.String json) throws OpenemsError.OpenemsNamedException
Parses a JSON String to aJsonrpcResponse
.- Parameters:
json
- the JSON String- Returns:
- the
JsonrpcResponse
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
from
public static JsonrpcResponse from(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException
Parses aJsonObject
to aJsonrpcResponse
.- Parameters:
j
- theJsonObject
- Returns:
- the
JsonrpcResponse
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
getId
public java.util.UUID getId()
-
toJsonObject
public com.google.gson.JsonObject toJsonObject()
Description copied from class:JsonrpcMessage
Gets theJsonObject
representation of thisJsonrpcMessage
.- Overrides:
toJsonObject
in classJsonrpcMessage
- Returns:
- a
JsonObject
-
-