StratumMessage { @JsonIgnore public boolean isResult() { return id != null && result != null; } StratumMessage(); @JsonIgnore  StratumMessage(Long id, String method, List<Object> params, ObjectMapper mapper); @JsonIgnore  StratumMessage(Long id, String method, List<JsonNode> params, JsonNode result, ObjectMapper mapper); @JsonIgnore  StratumMessage(Long id, JsonNode result); @JsonIgnore  StratumMessage(Long id, String method, JsonNode result); @JsonIgnore boolean isResult(); @JsonIgnore boolean isMessage(); @JsonIgnore boolean isSentinel(); @JsonIgnore boolean isError(); public Long id; public String method; public List<JsonNode> params; @JsonProperty("result")
    public JsonNode result; @JsonProperty("error")
    public String error; static final StratumMessage SENTINEL; }
@Test public void deserialize() throws Exception { StratumMessage m1 = readValue("{\"id\":123, \"method\":\"a.b\", \"params\":[1, \"x\", null]}"); assertEquals(123L, (long)m1.id); assertEquals("a.b", m1.method); assertEquals(Lists.newArrayList(new IntNode(1), new TextNode("x"), NullNode.getInstance()), m1.params); StratumMessage m2 = readValue("{\"id\":123, \"result\":{\"x\": 123}}"); assertTrue(m2.isResult()); assertEquals(123L, (long)m2.id); assertEquals(mapper.createObjectNode().put("x", 123), m2.result); StratumMessage m3 = readValue("{\"id\":123, \"result\":[\"x\"]}"); assertEquals(123L, (long)m3.id); assertEquals(mapper.createArrayNode().add("x"), m3.result); }