Class JsonRpcEvent


  • public class JsonRpcEvent
    extends java.lang.Object
    Java bean representation of an event.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ERROR_KEY  
      static java.lang.String MESSAGE_FORMAT  
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonRpcEvent​(java.lang.String method, com.fasterxml.jackson.databind.JsonNode params)
      Creates notification object.
    • Constructor Detail

      • JsonRpcEvent

        public JsonRpcEvent​(java.lang.String method,
                            com.fasterxml.jackson.databind.JsonNode params)
        Creates notification object.
        Parameters:
        method - - Name of the method which will be executed remotely.
        params - - Parameters used to execute method.
    • Method Detail

      • getMethod

        public java.lang.String getMethod()
        Returns:
        Id of this event which is used to match a subscriber.
      • setMethod

        public void setMethod​(java.lang.String method)
      • getParams

        public com.fasterxml.jackson.databind.JsonNode getParams()
        Returns:
        Content of an event.
      • setParams

        public void setParams​(com.fasterxml.jackson.databind.JsonNode node)
      • fromJsonNode

        public static JsonRpcEvent fromJsonNode​(com.fasterxml.jackson.databind.JsonNode node)
        Validates and builds JsonRpcEvent based on provided json node.
        Parameters:
        node - - Json representation of the notification.
        Returns:
        Notification object.
      • fromMethodAndParams

        public static JsonRpcEvent fromMethodAndParams​(java.lang.String method,
                                                       java.util.Map<java.lang.String,​java.lang.Object> params)
                                                throws java.io.IOException
        Create 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:
        JsonRpcEvent representing an event.
        Throws:
        java.io.IOException - - The exception thrown if params cannot be serialized.
      • fromByteArray

        public static JsonRpcEvent fromByteArray​(byte[] message)
        Parameters:
        message - - byte array representation of the notification.
        Returns:
        Request object.
        See Also:
        fromJsonNode(JsonNode)
      • toJson

        public com.fasterxml.jackson.databind.JsonNode toJson()
        Returns:
        Content of this bean as JsonNode.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getArrivalTime

        public long getArrivalTime()
      • setArrivalTime

        public void setArrivalTime​(long arrivalTime)