View Javadoc

1   /*
2    * Copyright (C) 2013 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   * Represents JIRA Security Level
26   *
27   * @since v2.0
28   */
29  public class SecurityLevel extends AddressableNamedEntity implements IdentifiableEntity<Long> {
30  
31      private final Long id;
32      private final String description;
33  
34      public SecurityLevel(final URI self, final Long id, final String name, final String description) {
35          super(self, name);
36          this.id = id;
37          this.description = description;
38      }
39  
40      @Override
41      public Long getId() {
42          return id;
43      }
44  
45      public String getDescription() {
46          return description;
47      }
48  
49      @Override
50      public int hashCode() {
51          return Objects.hashCode(super.hashCode(), id, description);
52      }
53  
54      @Override
55      public boolean equals(Object obj) {
56          if (obj instanceof SecurityLevel) {
57              final SecurityLevel that = (SecurityLevel) obj;
58              return super.equals(that)
59                      && Objects.equal(this.id, that.id)
60                      && Objects.equal(this.description, that.description);
61          }
62          return false;
63      }
64  
65      @Override
66      protected Objects.ToStringHelper getToStringHelper() {
67          return super.getToStringHelper()
68                  .add("id", id)
69                  .add("description", description);
70      }
71  }