package com.github.arteam.simplejsonrpc.core.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ValueNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;


/**
 * Date: 07.06.14
 * Time: 12:24
 * <p>Representation of a JSON-RPC request</p>
 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @NotNull
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

    public Request(@JsonProperty("jsonrpc") @Nullable String jsonrpc,
                   @JsonProperty("method") @Nullable String method,
                   @JsonProperty("params") @NotNull JsonNode params,
                   @JsonProperty("id") @Nullable ValueNode id) {
        this.jsonrpc = jsonrpc;
        this.method = method;
        this.id = id;
        this.params = params;
    }

    @Nullable
    public String getJsonrpc() {
        return jsonrpc;
    }

    @Nullable
    public String getMethod() {
        return method;
    }

    @NotNull
    public ValueNode getId() {
        return id != null ? id : NullNode.getInstance();
    }

    @NotNull
    public JsonNode getParams() {
        return params;
    }

    @Override
    public String toString() {
        return "Request{jsonrpc=" + jsonrpc + ", method=" + method + ", id=" + id + ", params=" + params + "}";
    }
}

@@ -554,30 +554,31 @@
 hod;%0A%0A    @N
-otN
 ull
+able
 %0A    private
@@ -832,22 +832,23 @@
 ams%22) @N
-otN
 ull
+able
  JsonNod
@@ -1369,24 +1369,66 @@
 eturn params
+ != null ? params : NullNode.getInstance()
 ;%0A    %7D%0A%0A   

Check that params can be null