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