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.AddressableEntity;
20  import com.google.common.base.Objects;
21  
22  import java.net.URI;
23  
24  /**
25   * Basic information about issue type.
26   *
27   * @since v0.1
28   */
29  public class BasicIssueType implements AddressableEntity {
30  	private final URI self;
31  
32  	private final String name;
33  
34  	private final boolean isSubtask;
35  
36  	public BasicIssueType(URI self, String name, boolean isSubtask) {
37  		this.self = self;
38  		this.name = name;
39  		this.isSubtask = isSubtask;
40  	}
41  
42  	public String getName() {
43  		return name;
44  	}
45  
46  	public boolean isSubtask() {
47  		return isSubtask;
48  	}
49  
50  	@Override
51  	public URI getSelf() {
52  		return self;
53  	}
54  
55  	@Override
56  	public String toString() {
57  		return Objects.toStringHelper(this).
58  				add("self", self).
59  				add("name", name).
60  				add("isSubtask", isSubtask).
61  				toString();
62  	}
63  
64  
65  	@Override
66  	public boolean equals(Object obj) {
67  		if (obj instanceof BasicIssueType) {
68  			BasicIssueType that = (BasicIssueType) obj;
69  			return Objects.equal(this.self, that.self)
70  					&& Objects.equal(this.name, that.name)
71  					&& Objects.equal(this.isSubtask, that.isSubtask);
72  		}
73  		return false;
74  	}
75  
76  	@Override
77  	public int hashCode() {
78  		return Objects.hashCode(self, name, isSubtask);
79  	}
80  }