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.domain;
18  
19  import com.atlassian.jira.rest.client.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  	private final String name;
33  	private final String description;
34  	private final Direction direction;
35  
36  	public IssueLinkType(String name, String description, Direction direction) {
37  		this.name = name;
38  		this.description = description;
39  		this.direction = direction;
40  	}
41  
42  	public String getName() {
43  		return name;
44  	}
45  
46  	public String getDescription() {
47  		return description;
48  	}
49  
50  	public Direction getDirection() {
51  		return direction;
52  	}
53  
54  	@Override
55  	public String toString() {
56  		return Objects.toStringHelper(this).
57  				add("name", name).
58  				add("description", description).
59  				add("direction", direction).
60  				toString();
61  	}
62  
63  	@Override
64  	public boolean equals(Object obj) {
65  		if (obj instanceof IssueLinkType) {
66  			IssueLinkType that = (IssueLinkType) obj;
67  			return Objects.equal(this.name, that.name)
68  					&& Objects.equal(this.description, that.description)
69  					&& Objects.equal(this.direction, that.direction);
70  		}
71  		return false;
72  	}
73  
74  	@Override
75  	public int hashCode() {
76  		return Objects.hashCode(name, description, direction);
77  	}
78  
79  }