View Javadoc

1   /*
2    * Copyright (C) 2010 Atlassian
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.jira.rest.client.api.domain;
18  
19  import com.atlassian.jira.rest.client.api.IdentifiableEntity;
20  import com.google.common.base.Objects;
21  
22  import java.net.URI;
23  
24  /**
25   * Basic information about a JIRA issue status
26   *
27   * @since v0.1
28   */
29  public class Status extends AddressableNamedEntity implements IdentifiableEntity<Long> {
30      private final Long id;
31      private final String description;
32      private final URI iconUrl;
33  
34      public Status(URI self, final Long id, final String name, final String description, final URI iconUrl) {
35          super(self, name);
36          this.id = id;
37          this.description = description;
38          this.iconUrl = iconUrl;
39      }
40  
41      @Override
42      public String toString() {
43          return getToStringHelper().
44                  add("id", id).
45                  add("description", description).
46                  add("iconUrl", iconUrl).
47                  toString();
48      }
49  
50      @Override
51      public boolean equals(Object obj) {
52          if (obj instanceof Status) {
53              Status that = (Status) obj;
54              return super.equals(obj)
55                      && Objects.equal(this.id, that.id)
56                      && Objects.equal(this.description, that.description)
57                      && Objects.equal(this.iconUrl, that.iconUrl);
58          }
59          return false;
60      }
61  
62      @Override
63      public int hashCode() {
64          return Objects.hashCode(super.hashCode(), id, description, iconUrl);
65      }
66  
67      @Override
68      public Long getId() {
69          return id;
70      }
71  
72      public String getDescription() {
73          return description;
74      }
75  
76      public URI getIconUrl() {
77          return iconUrl;
78      }
79  }