Package org.ovirt.vdsm.jsonrpc.client
Class JsonRpcEvent
java.lang.Object
org.ovirt.vdsm.jsonrpc.client.JsonRpcEvent
Java bean representation of an event.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJsonRpcEvent(String method, com.fasterxml.jackson.databind.JsonNode params) Creates notification object. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonRpcEventfromByteArray(byte[] message) static JsonRpcEventfromJsonNode(com.fasterxml.jackson.databind.JsonNode node) Validates and buildsJsonRpcEventbased on provided json node.static JsonRpcEventfromMethodAndParams(String method, Map<String, Object> params) Create notification object for the method and params.longcom.fasterxml.jackson.databind.JsonNodevoidsetArrivalTime(long arrivalTime) voidvoidsetParams(com.fasterxml.jackson.databind.JsonNode node) com.fasterxml.jackson.databind.JsonNodetoJson()toString()
-
Field Details
-
ERROR_KEY
- See Also:
-
MESSAGE_FORMAT
- See Also:
-
MAPPER
private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER -
method
-
params
private com.fasterxml.jackson.databind.JsonNode params -
arrivalTime
private long arrivalTime
-
-
Constructor Details
-
JsonRpcEvent
Creates notification object.- Parameters:
method- - Name of the method which will be executed remotely.params- - Parameters used to execute method.
-
-
Method Details
-
getMethod
- Returns:
- Id of this event which is used to match a subscriber.
-
setMethod
-
getParams
public com.fasterxml.jackson.databind.JsonNode getParams()- Returns:
- Content of an event.
-
setParams
public void setParams(com.fasterxml.jackson.databind.JsonNode node) -
fromJsonNode
Validates and buildsJsonRpcEventbased on provided json node.- Parameters:
node- - Json representation of the notification.- Returns:
- Notification object.
-
fromMethodAndParams
public static JsonRpcEvent fromMethodAndParams(String method, Map<String, Object> params) throws IOExceptionCreate notification object for the method and params.- Parameters:
method- - Name of the method which will be executed remotely.params- - Parameters used to execute method.- Returns:
JsonRpcEventrepresenting an event.- Throws:
IOException- - The exception thrown if params cannot be serialized.
-
fromByteArray
- Parameters:
message- - byte array representation of the notification.- Returns:
- Request object.
- See Also:
-
toJson
public com.fasterxml.jackson.databind.JsonNode toJson()- Returns:
- Content of this bean as
JsonNode.
-
toString
-
getArrivalTime
public long getArrivalTime() -
setArrivalTime
public void setArrivalTime(long arrivalTime)
-