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 public class CimFieldInfo implements NamedEntity, IdentifiableEntity<String> {
36
37 private final String id;
38 private final boolean required;
39 @Nullable
40 private final String name;
41 private final FieldSchema schema;
42 private final Set<StandardOperation> operations;
43 @Nullable
44 private final Iterable<Object> allowedValues;
45 @Nullable
46 private final URI autoCompleteUri;
47
48
49 public CimFieldInfo(String id, boolean required, @Nullable String name, FieldSchema schema,
50 Set<StandardOperation> operations, @Nullable Iterable<Object> allowedValues, @Nullable URI autoCompleteUri) {
51 this.id = id;
52 this.required = required;
53 this.name = name;
54 this.schema = schema;
55 this.operations = operations;
56 this.allowedValues = allowedValues;
57 this.autoCompleteUri = autoCompleteUri;
58 }
59
60 public String getId() {
61 return id;
62 }
63
64 public boolean isRequired() {
65 return required;
66 }
67
68 @Nullable
69 public String getName() {
70 return name;
71 }
72
73
74
75
76
77
78 public FieldSchema getSchema() {
79 return schema;
80 }
81
82
83
84
85
86
87 public Set<StandardOperation> getOperations() {
88 return operations;
89 }
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 }