forked from intercom/intercom-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJobItem.java
More file actions
130 lines (102 loc) · 3.64 KB
/
Copy pathJobItem.java
File metadata and controls
130 lines (102 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package io.intercom.api;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings("UnusedDeclaration")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class JobItem<T extends TypedData> extends TypedData {
@JsonProperty("type")
private final String type = "job_item";
@JsonProperty("id")
private String id;
@JsonProperty("updated_at")
private long updatedAt;
@JsonProperty("method")
private String method;
@JsonProperty("data_type")
private String dataType;
@JsonProperty("error")
private Error error;
@JsonProperty("data")
private T data;
public JobItem() {
}
public JobItem(String method, T data) {
checkNotNull(method, data);
this.method = method;
this.data = data;
this.dataType = data.getType();
}
private void checkNotNull(String method, T data) {
Conditions.checkNotNull(method, "item method must be supplied");
Conditions.checkNotNull(data, "item data must be supplied");
}
public String getType() {
return type;
}
public String getID() {
return id;
}
public long getUpdatedAt() {
return updatedAt;
}
public String getMethod() {
return method;
}
public JobItem<T> setMethod(String method) {
this.method = method;
return this;
}
public Error getError() {
return error;
}
public T getData() {
return data;
}
public JobItem<T> setData(T data) {
this.data = data;
return this;
}
public String getDataType() {
return dataType;
}
@Override
public String toString() {
return "JobItem{" +
"type='" + type + '\'' +
", id='" + id + '\'' +
", updatedAt=" + updatedAt +
", method='" + method + '\'' +
", dataType='" + dataType + '\'' +
", error=" + error +
", data=" + data +
"} " + super.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
JobItem<?> jobItem = (JobItem<?>) o;
if (updatedAt != jobItem.updatedAt) return false;
//noinspection ConstantConditions
if (type != null ? !type.equals(jobItem.type) : jobItem.type != null) return false;
if (id != null ? !id.equals(jobItem.id) : jobItem.id != null) return false;
if (method != null ? !method.equals(jobItem.method) : jobItem.method != null) return false;
if (dataType != null ? !dataType.equals(jobItem.dataType) : jobItem.dataType != null) return false;
//noinspection SimplifiableIfStatement
if (error != null ? !error.equals(jobItem.error) : jobItem.error != null) return false;
return !(data != null ? !data.equals(jobItem.data) : jobItem.data != null);
}
@Override
public int hashCode() {
@SuppressWarnings("ConstantConditions") int result = type != null ? type.hashCode() : 0;
result = 31 * result + (id != null ? id.hashCode() : 0);
result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
result = 31 * result + (method != null ? method.hashCode() : 0);
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
result = 31 * result + (error != null ? error.hashCode() : 0);
result = 31 * result + (data != null ? data.hashCode() : 0);
return result;
}
}