1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.domain;
18
19 import com.google.common.base.Objects;
20
21 import javax.annotation.Nullable;
22
23
24
25
26
27 public class ChangelogItem {
28 private final FieldType fieldType;
29 private final String field;
30 private final String from;
31 private final String fromString;
32 private final String to;
33 private final String toString;
34
35 public ChangelogItem(FieldType fieldType, String field, String from, String fromString, String to, String toString) {
36 this.fieldType = fieldType;
37 this.field = field;
38 this.from = from;
39 this.fromString = fromString;
40 this.to = to;
41 this.toString = toString;
42 }
43
44 public FieldType getFieldType() {
45 return fieldType;
46 }
47
48 public String getField() {
49 return field;
50 }
51
52 @Nullable
53 public String getFrom() {
54 return from;
55 }
56
57 @Nullable
58 public String getFromString() {
59 return fromString;
60 }
61
62 @Nullable
63 public String getTo() {
64 return to;
65 }
66
67 @Nullable
68 public String getToString() {
69 return toString;
70 }
71
72 @Override
73 public boolean equals(Object obj) {
74 if (obj instanceof ChangelogItem) {
75 ChangelogItem that = (ChangelogItem) obj;
76 return Objects.equal(this.fieldType, that.fieldType)
77 && Objects.equal(this.field, that.field)
78 && Objects.equal(this.from, that.from)
79 && Objects.equal(this.fromString, that.fromString)
80 && Objects.equal(this.to, that.to)
81 && Objects.equal(this.toString, that.toString);
82 }
83 return false;
84
85 }
86
87 @Override
88 public int hashCode() {
89 return Objects.hashCode(fieldType, field, from, fromString, to, toString);
90 }
91
92 @Override
93 public String toString() {
94 return Objects.toStringHelper(this).
95 add("fieldType", fieldType).
96 add("field", field).
97 add("from", from).
98 add("fromString", fromString).
99 add("to", to).
100 add("toString", toString).
101 toString();
102 }
103
104 public enum FieldType {
105 JIRA, CUSTOM
106 }
107 }