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 import java.net.URI;
23
24
25
26
27
28
29 public class CustomFieldOption {
30
31 private final URI self;
32 private final Long id;
33 private final String value;
34 private final Iterable<CustomFieldOption> children;
35 @Nullable
36 private final CustomFieldOption child;
37
38 public CustomFieldOption(Long id, URI self, String value, Iterable<CustomFieldOption> children, @Nullable CustomFieldOption child) {
39 this.value = value;
40 this.id = id;
41 this.self = self;
42 this.children = children;
43 this.child = child;
44 }
45
46 public URI getSelf() {
47 return self;
48 }
49
50 public Long getId() {
51 return id;
52 }
53
54 public String getValue() {
55 return value;
56 }
57
58 public Iterable<CustomFieldOption> getChildren() {
59 return children;
60 }
61
62 @Nullable
63 public CustomFieldOption getChild() {
64 return child;
65 }
66
67
68
69
70
71 protected Objects.ToStringHelper getToStringHelper() {
72 return Objects.toStringHelper(this)
73 .add("self", self)
74 .add("id", id)
75 .add("value", value)
76 .add("children", children)
77 .add("child", child);
78 }
79
80 @Override
81 public String toString() {
82 return getToStringHelper().toString();
83 }
84
85 @Override
86 public int hashCode() {
87 return Objects.hashCode(self, id, value, children, child);
88 }
89
90 @Override
91 public boolean equals(Object obj) {
92 if (obj == null) {
93 return false;
94 }
95 if (getClass() != obj.getClass()) {
96 return false;
97 }
98 final CustomFieldOption other = (CustomFieldOption) obj;
99 return Objects.equal(this.self, other.self)
100 && Objects.equal(this.id, other.id)
101 && Objects.equal(this.value, other.value)
102 && Objects.equal(this.children, other.children)
103 && Objects.equal(this.child, other.child);
104 }
105 }