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