Class JsonRpcRequest


  • public class JsonRpcRequest
    extends java.lang.Object
    Java bean representation of the request.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private com.fasterxml.jackson.databind.JsonNode id  
      private static com.fasterxml.jackson.databind.ObjectMapper MAPPER  
      private java.lang.String method  
      private com.fasterxml.jackson.databind.JsonNode params  
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonRpcRequest​(java.lang.String method, com.fasterxml.jackson.databind.JsonNode params, com.fasterxml.jackson.databind.JsonNode id)
      Creates request object.
    • Field Detail

      • MAPPER

        private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
      • method

        private java.lang.String method
      • params

        private com.fasterxml.jackson.databind.JsonNode params
      • id

        private com.fasterxml.jackson.databind.JsonNode id
    • Constructor Detail

      • JsonRpcRequest

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

      • getMethod

        public java.lang.String getMethod()
      • setMethod

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

        public com.fasterxml.jackson.databind.JsonNode getParams()
      • setParams

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

        public com.fasterxml.jackson.databind.JsonNode getId()
      • setId

        public void setId​(com.fasterxml.jackson.databind.JsonNode node)
      • getPlainId

        public java.lang.String getPlainId()
      • fromJsonNode

        public static JsonRpcRequest fromJsonNode​(com.fasterxml.jackson.databind.JsonNode node)
        Validates and builds JsonRpcRequest based on provided json node.
        Parameters:
        node - - Json representation of the request.
        Returns:
        Request object.
      • fromByteArray

        public static JsonRpcRequest fromByteArray​(byte[] message)
        Parameters:
        message - - byte array representation of the request.
        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