]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/jsonrpc/JsonRpcRequest.java
Show better error message when receiving an empty JSON RPC line
[signal-cli] / src / main / java / org / asamk / signal / jsonrpc / JsonRpcRequest.java
index 1ae8552a8cb4af03f3382aa2d0d0f16c4c239608..29866c1a3fe19a7b6e90c12d402f29089488cab8 100644 (file)
@@ -6,28 +6,28 @@ import com.fasterxml.jackson.databind.node.ValueNode;
 
 /**
  * Represents a JSON-RPC request.
 
 /**
  * Represents a JSON-RPC request.
- * https://www.jsonrpc.org/specification#request_object
+ * <a href="https://www.jsonrpc.org/specification#request_object">https://www.jsonrpc.org/specification#request_object</a>
  */
  */
-public class JsonRpcRequest extends JsonRpcMessage {
+public final class JsonRpcRequest extends JsonRpcMessage {
 
     /**
      * A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
      */
 
     /**
      * A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
      */
-    String jsonrpc;
+    private String jsonrpc;
 
     /**
      * A String containing the name of the method to be invoked.
      * Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46)
      * are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
      */
 
     /**
      * A String containing the name of the method to be invoked.
      * Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46)
      * are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
      */
-    String method;
+    private String method;
 
     /**
      * A Structured value that holds the parameter values to be used during the invocation of the method.
      * This member MAY be omitted.
      */
     @JsonInclude(JsonInclude.Include.NON_NULL)
 
     /**
      * A Structured value that holds the parameter values to be used during the invocation of the method.
      * This member MAY be omitted.
      */
     @JsonInclude(JsonInclude.Include.NON_NULL)
-    ContainerNode<?> params;
+    private ContainerNode<?> params;
 
     /**
      * An identifier established by the Client that MUST contain a String, Number, or NULL value if included.
 
     /**
      * An identifier established by the Client that MUST contain a String, Number, or NULL value if included.
@@ -35,10 +35,12 @@ public class JsonRpcRequest extends JsonRpcMessage {
      * The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts
      */
     @JsonInclude(JsonInclude.Include.NON_NULL)
      * The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts
      */
     @JsonInclude(JsonInclude.Include.NON_NULL)
-    ValueNode id;
+    private ValueNode id;
 
     public static JsonRpcRequest forNotification(
 
     public static JsonRpcRequest forNotification(
-            final String method, final ContainerNode<?> params, final ValueNode id
+            final String method,
+            final ContainerNode<?> params,
+            final ValueNode id
     ) {
         return new JsonRpcRequest("2.0", method, params, id);
     }
     ) {
         return new JsonRpcRequest("2.0", method, params, id);
     }
@@ -47,7 +49,10 @@ public class JsonRpcRequest extends JsonRpcMessage {
     }
 
     private JsonRpcRequest(
     }
 
     private JsonRpcRequest(
-            final String jsonrpc, final String method, final ContainerNode<?> params, final ValueNode id
+            final String jsonrpc,
+            final String method,
+            final ContainerNode<?> params,
+            final ValueNode id
     ) {
         this.jsonrpc = jsonrpc;
         this.method = method;
     ) {
         this.jsonrpc = jsonrpc;
         this.method = method;