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.AddressableEntity;
20 import com.atlassian.jira.rest.client.NamedEntity;
21 import com.google.common.base.Objects;
22
23 import javax.annotation.Nullable;
24 import java.net.URI;
25
26
27
28
29
30
31 public class BasicComponent implements AddressableEntity, NamedEntity {
32 @Nullable
33 private final Long id;
34 private final URI self;
35 private final String name;
36 @Nullable
37 private final String description;
38
39 public BasicComponent(URI self, @Nullable Long id, String name, @Nullable String description) {
40 this.self = self;
41 this.id = id;
42 this.name = name;
43 this.description = description;
44 }
45
46 @Override
47 public URI getSelf() {
48 return self;
49 }
50
51 public String getName() {
52 return name;
53 }
54
55 @Nullable
56 public Long getId() {
57 return id;
58 }
59
60
61
62
63 @Nullable
64 public String getDescription() {
65 return description;
66 }
67
68 @Override
69 public String toString() {
70 return Objects.toStringHelper(this).
71 add("id", id).
72 add("self", self).
73 add("name", name).
74 add("description", description).
75 toString();
76 }
77
78 @Override
79 public boolean equals(Object obj) {
80 if (obj instanceof BasicComponent) {
81 BasicComponent that = (BasicComponent) obj;
82 return Objects.equal(this.self, that.self)
83 && Objects.equal(this.id, that.id)
84 && Objects.equal(this.name, that.name)
85 && Objects.equal(this.description, that.description);
86 }
87 return false;
88 }
89
90 @Override
91 public int hashCode() {
92 return Objects.hashCode(self, name, description);
93 }
94
95 }