1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package cz.hobrasoft.pdfmu.jackson;
18
19 import com.fasterxml.jackson.annotation.JsonInclude;
20 import com.fasterxml.jackson.annotation.JsonInclude.Include;
21 import com.fasterxml.jackson.annotation.JsonProperty;
22 import com.fasterxml.jackson.annotation.JsonPropertyDescription;
23
24
25
26
27
28 public class RpcResponse {
29
30 @JsonPropertyDescription("A String specifying the version of the JSON-RPC protocol. MUST be exactly \"2.0\".")
31 @JsonProperty(required = true)
32 public final String jsonrpc = "2.0";
33
34 @JsonPropertyDescription("It MUST be the same as the value of the id member in the Request Object (String, Number or Null).\n"
35 + "If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.")
36 @JsonProperty(required = true)
37 public final Object id = null;
38
39
40 @JsonPropertyDescription("This member is REQUIRED on success.\n"
41 + "This member MUST NOT exist if there was an error invoking the method.\n"
42 + "The value of this member is determined by the method invoked on the Server.")
43 @JsonInclude(Include.NON_NULL)
44 private Result result;
45
46 @JsonPropertyDescription("This member is REQUIRED on error.\n"
47 + "This member MUST NOT exist if there was no error triggered during invocation.")
48 @JsonInclude(Include.NON_NULL)
49 private RpcError error;
50
51 public RpcResponse(Result result) {
52 assert result != null;
53 this.result = result;
54 }
55
56 public RpcResponse(RpcError error) {
57 assert error != null;
58 this.error = error;
59 }
60
61 public Result getResult() {
62 return result;
63 }
64
65 public RpcError getError() {
66 return error;
67 }
68 }