1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.services.eansearch.model;
19
20 import com.fasterxml.jackson.annotation.JsonIgnore;
21 import com.fasterxml.jackson.annotation.JsonInclude;
22 import lombok.AllArgsConstructor;
23 import lombok.Builder;
24 import lombok.Getter;
25 import lombok.NoArgsConstructor;
26 import lombok.experimental.SuperBuilder;
27 import lombok.extern.jackson.Jacksonized;
28
29
30
31
32
33
34
35 @Jacksonized
36 @SuperBuilder(toBuilder = true)
37 @AllArgsConstructor
38 @NoArgsConstructor
39 @Getter
40 @JsonInclude(JsonInclude.Include.NON_ABSENT)
41 public class VerifyChecksumResponse {
42 Product product;
43
44 @JsonIgnore
45 public String getEan() {
46 return product.getEan();
47 }
48
49 @JsonIgnore
50 public boolean isValid() {
51 return product.isValid();
52 }
53
54 @Jacksonized
55 @Builder(toBuilder = true)
56 @AllArgsConstructor
57 @NoArgsConstructor
58 @Getter
59 @JsonInclude(JsonInclude.Include.NON_ABSENT)
60 public static class Product {
61 String ean;
62 Integer valid;
63
64 @JsonIgnore
65 boolean isValid() {
66 return valid == 1;
67 }
68 }
69 }