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