Package io.openems.common.jsonrpc.base
Class JsonrpcMessage
java.lang.Object
io.openems.common.jsonrpc.base.JsonrpcMessage
- Direct Known Subclasses:
AbstractJsonrpcRequest
,JsonrpcResponse
Represents a JSON-RPC Message.
{ "jsonrpc": "2.0", ... }
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonrpcMessage
from
(com.google.gson.JsonObject j) Parses aJsonObject
to aJsonrpcMessage
.static JsonrpcMessage
Parses a JSON String to aJsonrpcMessage
.com.google.gson.JsonObject
Gets theJsonObject
representation of thisJsonrpcMessage
.toString()
Returns this JsonrpcMessage as a JSON String.
-
Field Details
-
JSONRPC_VERSION
- See Also:
-
-
Constructor Details
-
JsonrpcMessage
public JsonrpcMessage()
-
-
Method Details
-
from
Parses a JSON String to aJsonrpcMessage
.- Parameters:
json
- the JSON String- Returns:
- the
JsonrpcMessage
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
from
public static JsonrpcMessage from(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException Parses aJsonObject
to aJsonrpcMessage
.- Parameters:
j
- theJsonObject
- Returns:
- the
JsonrpcMessage
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
toJsonObject
public com.google.gson.JsonObject toJsonObject()Gets theJsonObject
representation of thisJsonrpcMessage
.- Returns:
- a
JsonObject
-
toString
Returns this JsonrpcMessage as a JSON String.
-