View Javadoc
1   /* 
2    * Copyright (C) 2016 Hobrasoft s.r.o.
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU Affero General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU Affero General Public License for more details.
13   *
14   * You should have received a copy of the GNU Affero General Public License
15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
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  import java.util.Map;
24  
25  /**
26   *
27   * @author <a href="mailto:filip.bartek@hobrasoft.cz">Filip Bartek</a>
28   */
29  public class RpcError {
30  
31      @JsonPropertyDescription("A Number that indicates the error type that occurred.")
32      @JsonProperty(required = true)
33      public int code;
34  
35      @JsonPropertyDescription("A String providing a short description of the error.\n"
36              + "The message SHOULD be limited to a concise single sentence.")
37      @JsonProperty(required = true)
38      public String message;
39  
40      public static class Data {
41  
42          @JsonInclude(Include.NON_NULL)
43          public Class causeClass;
44  
45          @JsonInclude(Include.NON_NULL)
46          public String causeMessage;
47  
48          @JsonInclude(Include.NON_NULL)
49          public Map<String, Object> arguments;
50      }
51  
52      @JsonPropertyDescription("A Primitive or Structured value that contains additional information about the error.\n"
53              + "This may be omitted.\n"
54              + "The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).")
55      @JsonInclude(Include.NON_NULL)
56      public Data data;
57  
58      public RpcError(int code, String message) {
59          this.code = code;
60          this.message = message;
61      }
62  }