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