Package io.openems.common.jsonrpc.base
Class GenericJsonrpcRequest
java.lang.Object
io.openems.common.jsonrpc.base.JsonrpcMessage
io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
io.openems.common.jsonrpc.base.JsonrpcRequest
io.openems.common.jsonrpc.base.GenericJsonrpcRequest
Represents a generic JSON-RPC Request.
{ "jsonrpc": "2.0", "id": "UUID", "method": string, "params": {}, "timeout"?: number, defaults to 60 seconds; negative or zero to disable timeout }
- See Also:
-
Field Summary
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcRequest
DEFAULT_TIMEOUT_SECONDS, id, NO_TIMEOUT, timeoutOpt
Fields inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
JSONRPC_VERSION
-
Constructor Summary
ConstructorDescriptionGenericJsonrpcRequest
(String method, com.google.gson.JsonObject params) GenericJsonrpcRequest
(UUID id, String method, com.google.gson.JsonObject params, int timeout) GenericJsonrpcRequest
(UUID id, String method, com.google.gson.JsonObject params, Optional<Integer> timeoutOpt) -
Method Summary
Modifier and TypeMethodDescriptionstatic GenericJsonrpcRequest
from
(com.google.gson.JsonObject j) Parses theJsonObject
to aGenericJsonrpcRequest
.static GenericJsonrpcRequest
Parses the String to aGenericJsonrpcRequest
.static GenericJsonrpcRequest
fromIgnoreId
(com.google.gson.JsonObject j) Parses theJsonObject
to aGenericJsonrpcRequest
.static GenericJsonrpcRequest
fromIgnoreId
(String json) Parses the String to aGenericJsonrpcRequest
.com.google.gson.JsonObject
Gets the paramsJsonObject
of theJsonrpcRequest
.Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcRequest
getId, getTimeout, toJsonObject
Methods inherited from class io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
getFullyQualifiedMethod, getMethod
Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
toString
-
Constructor Details
-
GenericJsonrpcRequest
-
GenericJsonrpcRequest
-
GenericJsonrpcRequest
-
-
Method Details
-
from
Parses the String to aGenericJsonrpcRequest
.- Parameters:
json
- the String- Returns:
- the
GenericJsonrpcRequest
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
from
public static GenericJsonrpcRequest from(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException Parses theJsonObject
to aGenericJsonrpcRequest
.- Parameters:
j
- theJsonObject
- Returns:
- the
GenericJsonrpcRequest
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
fromIgnoreId
public static GenericJsonrpcRequest fromIgnoreId(String json) throws OpenemsError.OpenemsNamedException Parses the String to aGenericJsonrpcRequest
. If the request UUID is missing, it is replaced by a random UUID.- Parameters:
json
- the String- Returns:
- the
GenericJsonrpcRequest
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
fromIgnoreId
public static GenericJsonrpcRequest fromIgnoreId(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException Parses theJsonObject
to aGenericJsonrpcRequest
. If the request UUID is missing, it is replaced by a random UUID.- Parameters:
j
- theJsonObject
- Returns:
- the
GenericJsonrpcRequest
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
getParams
public com.google.gson.JsonObject getParams()Description copied from class:AbstractJsonrpcRequest
Gets the paramsJsonObject
of theJsonrpcRequest
.- Specified by:
getParams
in classAbstractJsonrpcRequest
- Returns:
- the params as
JsonObject
-