View Javadoc
1   package cn.home1.oss.lib.errorhandle.api;
2   
3   import static lombok.AccessLevel.PRIVATE;
4   
5   import com.fasterxml.jackson.annotation.JsonInclude;
6   
7   import lombok.AllArgsConstructor;
8   import lombok.Builder;
9   import lombok.EqualsAndHashCode;
10  import lombok.Getter;
11  import lombok.NoArgsConstructor;
12  import lombok.Setter;
13  import lombok.ToString;
14  
15  import org.codehaus.jackson.map.annotate.JsonSerialize;
16  
17  import java.io.Serializable;
18  
19  import javax.xml.bind.annotation.XmlAccessType;
20  import javax.xml.bind.annotation.XmlAccessorType;
21  import javax.xml.bind.annotation.XmlElement;
22  import javax.xml.bind.annotation.XmlRootElement;
23  
24  /**
25   * Created by zhanghaolun on 16/7/3.
26   */
27  @XmlRootElement(name = "validationError")
28  @XmlAccessorType(XmlAccessType.FIELD)
29  // @com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement(localName = "error")
30  @JsonInclude(JsonInclude.Include.NON_EMPTY) // for Jackson 2.x
31  @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY) // for Jackson 1.x
32  @Builder(builderMethodName = "validationErrorBuilder")
33  @AllArgsConstructor(access = PRIVATE)
34  @NoArgsConstructor(access = PRIVATE)
35  @EqualsAndHashCode
36  @ToString
37  @Setter(PRIVATE)
38  @Getter
39  public class ValidationError implements Serializable {
40    @XmlElement
41    private String field;
42    @XmlElement
43    private String rejected;
44    @XmlElement
45    private String message;
46  }