1 package eu
.etaxonomy
.cdm
.io
.jaxb
;
3 import java
.util
.ArrayList
;
6 import javax
.xml
.bind
.annotation
.XmlAccessType
;
7 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
8 import javax
.xml
.bind
.annotation
.XmlAttribute
;
9 import javax
.xml
.bind
.annotation
.XmlElement
;
10 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
11 import javax
.xml
.bind
.annotation
.XmlRootElement
;
12 import javax
.xml
.bind
.annotation
.XmlType
;
14 @XmlAccessorType(XmlAccessType
.FIELD
)
15 @XmlType(name
= "Error", propOrder
= {
22 @XmlRootElement(name
= "Error")
25 private Integer status
;
27 @XmlElement(name
= "Message")
28 private String message
;
30 @XmlElement(name
= "Resource")
31 private String resource
;
33 @XmlElement(name
= "Cause")
36 @XmlElement(name
= "Code")
39 @XmlElementWrapper(name
= "StackTrace")
40 @XmlElement(name
= "StackTraceElement")
41 private List
<String
> stackTrace
;
47 public Error(Throwable throwable
) {
48 if(throwable
.getCause() != null) {
49 this.cause
= throwable
.getCause().getClass().getName();
51 this.message
= throwable
.getLocalizedMessage();
52 this.stackTrace
= new ArrayList
<String
>();
53 for(StackTraceElement ste
: throwable
.getStackTrace()) {
54 this.stackTrace
.add(ste
.toString());
58 public Integer
getStatus() {
62 public void setStatus(Integer status
) {
66 public String
getMessage() {
70 public void setMessage(String message
) {
71 this.message
= message
;
74 public String
getResource() {
78 public void setResource(String resource
) {
79 this.resource
= resource
;
82 public String
getCause() {
86 public void setCause(String cause
) {
90 public String
getCode() {
94 public void setCode(String code
) {
98 public List
<String
> getStackTrace() {
102 public void setStackTrace(List
<String
> stackTrace
) {
103 this.stackTrace
= stackTrace
;