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.NamedEntity;
20  import com.google.common.base.Objects;
21  
22  /**
23   * Type of a link between two JIRA issues
24   *
25   * @since v0.1
26   */
27  public class IssueLinkType implements NamedEntity {
28      public enum Direction {
29          OUTBOUND,
30          INBOUND
31      }
32  
33      private final String name;
34      private final String description;
35      private final Direction direction;
36  
37      public IssueLinkType(String name, String description, Direction direction) {
38          this.name = name;
39          this.description = description;
40          this.direction = direction;
41      }
42  
43      public String getName() {
44          return name;
45      }
46  
47      public String getDescription() {
48          return description;
49      }
50  
51      public Direction getDirection() {
52          return direction;
53      }
54  
55      @Override
56      public String toString() {
57          return Objects.toStringHelper(this).
58                  add("name", name).
59                  add("description", description).
60                  add("direction", direction).
61                  toString();
62      }
63  
64      @Override
65      public boolean equals(Object obj) {
66          if (obj instanceof IssueLinkType) {
67              IssueLinkType that = (IssueLinkType) obj;
68              return Objects.equal(this.name, that.name)
69                      && Objects.equal(this.description, that.description)
70                      && Objects.equal(this.direction, that.direction);
71          }
72          return false;
73      }
74  
75      @Override
76      public int hashCode() {
77          return Objects.hashCode(name, description, direction);
78      }
79  
80  }