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.atlassian.jira.rest.client.GetCreateIssueMetadataOptions;
20 import com.atlassian.jira.rest.client.IdentifiableEntity;
21 import com.atlassian.jira.rest.client.IssueRestClient;
22 import com.atlassian.jira.rest.client.NamedEntity;
23 import com.atlassian.jira.rest.client.ProgressMonitor;
24 import com.atlassian.jira.rest.client.internal.json.StandardOperation;
25 import com.atlassian.jira.rest.client.internal.json.FieldSchema;
26 import com.google.common.base.Objects;
27
28 import javax.annotation.Nullable;
29 import java.net.URI;
30 import java.util.Set;
31
32
33
34
35
36
37
38 public class CimFieldInfo implements NamedEntity, IdentifiableEntity<String> {
39
40 private final String id;
41 private final boolean required;
42 @Nullable
43 private final String name;
44 private final FieldSchema schema;
45 private final Set<StandardOperation> operations;
46 @Nullable
47 private final Iterable<Object> allowedValues;
48 @Nullable
49 private final URI autoCompleteUri;
50
51
52 public CimFieldInfo(String id, boolean required, @Nullable String name, FieldSchema schema,
53 Set<StandardOperation> operations, @Nullable Iterable<Object> allowedValues, @Nullable URI autoCompleteUri) {
54 this.id = id;
55 this.required = required;
56 this.name = name;
57 this.schema = schema;
58 this.operations = operations;
59 this.allowedValues = allowedValues;
60 this.autoCompleteUri = autoCompleteUri;
61 }
62
63 public String getId() {
64 return id;
65 }
66
67 public boolean isRequired() {
68 return required;
69 }
70
71 @Nullable
72 public String getName() {
73 return name;
74 }
75
76
77
78
79
80 public FieldSchema getSchema() {
81 return schema;
82 }
83
84
85
86
87
88 public Set<StandardOperation> getOperations() {
89 return operations;
90 }
91
92
93
94
95
96 @Nullable
97 public Iterable<Object> getAllowedValues() {
98 return allowedValues;
99 }
100
101
102
103
104
105
106
107
108 @SuppressWarnings("UnusedDeclaration")
109 @Nullable
110 public URI getAutoCompleteUri() {
111 return autoCompleteUri;
112 }
113
114
115
116
117
118
119 protected Objects.ToStringHelper getToStringHelper() {
120 return Objects.toStringHelper(this).
121 add("id", id).
122 add("name", name).
123 add("required", required).
124 add("schema", schema).
125 add("operations", operations).
126 add("allowedValues", allowedValues).
127 add("autoCompleteUri", autoCompleteUri);
128 }
129
130 @Override
131 public String toString() {
132 return getToStringHelper().toString();
133 }
134
135
136 @Override
137 public boolean equals(Object obj) {
138 if (obj instanceof CimFieldInfo) {
139 CimFieldInfo that = (CimFieldInfo) obj;
140 return Objects.equal(this.id, that.id)
141 && Objects.equal(this.name, that.name)
142 && Objects.equal(this.required, that.required)
143 && Objects.equal(this.schema, that.schema)
144 && Objects.equal(this.operations, that.operations)
145 && Objects.equal(this.allowedValues, that.allowedValues)
146 && Objects.equal(this.autoCompleteUri, that.autoCompleteUri);
147 }
148 return false;
149 }
150
151 @Override
152 public int hashCode() {
153 return Objects.hashCode(id, name, required, schema, operations, allowedValues, autoCompleteUri);
154 }
155 }