Class JsonRpcRequest


  • public class JsonRpcRequest
    extends JsonRpcMessage
    This class models a JSON-RPC Request.
    • Method Detail

      • create

        public static JsonRpcRequest create​(String method,
                                            Object id)
        Creates a new JSON-RPC request without parameters.
        Parameters:
        method - the method name
        id - the request ID (string, number or null)
        Returns:
        the request
      • create

        public static JsonRpcRequest create​(String method,
                                            Map<String,​?> params,
                                            Object id)
        Creates a new JSON-RPC request with parameters as a JSON object.
        Parameters:
        method - the method name
        params - the parameters
        id - the request ID (string, number or null)
        Returns:
        the request
      • create

        public static JsonRpcRequest create​(String method,
                                            List<?> params,
                                            Object id)
        Creates a new JSON-RPC request with parameters as a JSON array.
        Parameters:
        method - the method name
        params - the parameters
        id - the request ID (string, number or null)
        Returns:
        the request
      • getMethod

        public String getMethod()
        Returns the method name.
        Returns:
        the method name
      • getMapParams

        public Map<?,​?> getMapParams()
        Returns the parameters, if the request contains parameters as a JSON object. If the request has no parameters, or it has parameters as a JSON array, this method returns null.
        Returns:
        the parameters as a JSON object or null
        See Also:
        getListParams()
      • getListParams

        public List<?> getListParams()
        Returns the parameters, if the request contains parameters as a JSON array. If the request has no parameters, or it has parameters as a JSON object, this method returns null.
        Returns:
        the parameters as a JSON array or null
        See Also:
        getMapParams()
      • getID

        public Object getID()
        Returns the request ID (string, number or null).
        Returns:
        the request ID (string, number or null)