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 import org.joda.time.DateTime;
23
24 import javax.annotation.Nullable;
25 import java.net.URI;
26
27
28
29
30
31
32 public class Version implements AddressableEntity, NamedEntity {
33 private final URI self;
34 @Nullable
35 private final Long id;
36 private final String description;
37 private final String name;
38 private final boolean isArchived;
39 private final boolean isReleased;
40 @Nullable
41 private final DateTime releaseDate;
42
43 public Version(URI self, @Nullable Long id, String name, String description, boolean archived, boolean released, @Nullable DateTime releaseDate) {
44 this.self = self;
45 this.id = id;
46 this.description = description;
47 this.name = name;
48 isArchived = archived;
49 isReleased = released;
50 this.releaseDate = releaseDate;
51 }
52
53 @Override
54 public URI getSelf() {
55 return self;
56 }
57
58 @Nullable
59 public Long getId() {
60 return id;
61 }
62
63 public String getDescription() {
64 return description;
65 }
66
67 public String getName() {
68 return name;
69 }
70
71 public boolean isArchived() {
72 return isArchived;
73 }
74
75 public boolean isReleased() {
76 return isReleased;
77 }
78
79 @Nullable
80 public DateTime getReleaseDate() {
81 return releaseDate;
82 }
83
84 @Override
85 public String toString() {
86 return Objects.toStringHelper(this).
87 add("self", self).
88 add("id", id).
89 add("name", name).
90 add("description", description).
91 add("isArchived", isArchived).
92 add("isReleased", isReleased).
93 add("releaseDate", releaseDate).
94 toString();
95 }
96
97 @Override
98 public boolean equals(Object obj) {
99 if (obj instanceof Version) {
100 Version that = (Version) obj;
101 return Objects.equal(this.self, that.self)
102 && Objects.equal(this.id, that.id)
103 && Objects.equal(this.name, that.name)
104 && Objects.equal(this.description, that.description)
105 && Objects.equal(this.isArchived, that.isArchived)
106 && Objects.equal(this.isReleased, that.isReleased)
107 && Objects.equal(this.releaseDate, that.releaseDate);
108 }
109 return false;
110 }
111
112 @Override
113 public int hashCode() {
114 return Objects.hashCode(self, id, name, description, isArchived, isReleased, releaseDate);
115 }
116
117 }