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
Represents a JSON-RPC Response.
{ "jsonrpc": "2.0", "id": "UUID", ... }
- See Also:
-
Field Summary
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
JSONRPC_VERSION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonrpcResponse
from
(com.google.gson.JsonObject j) Parses aJsonObject
to aJsonrpcResponse
.static JsonrpcResponse
Parses a JSON String to aJsonrpcResponse
.getId()
com.google.gson.JsonObject
Gets theJsonObject
representation of thisJsonrpcMessage
.Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
toString
-
Constructor Details
-
JsonrpcResponse
-
-
Method Details
-
from
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
-
toJsonObject
public com.google.gson.JsonObject toJsonObject()Description copied from class:JsonrpcMessage
Gets theJsonObject
representation of thisJsonrpcMessage
.- Overrides:
toJsonObject
in classJsonrpcMessage
- Returns:
- a
JsonObject
-