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  import javax.annotation.Nullable;
22  import java.net.URI;
23  
24  /**
25   * Complete information about a single issue type defined in JIRA  
26   *
27   * @since v0.1
28   */
29  public class IssueType extends BasicIssueType {
30  	private final String description;
31  	private final URI iconUri;
32  
33  	public IssueType(URI self, @Nullable Long id, String name, boolean isSubtask, String description, URI iconUri) {
34  		super(self, id, name, isSubtask);
35  		this.description = description;
36  		this.iconUri = iconUri;
37  	}
38  
39  	public String getDescription() {
40  		return description;
41  	}
42  
43  	public URI getIconUri() {
44  		return iconUri;
45  	}
46  
47  	/**
48  	 * {@inheritDoc}
49  	 */
50  	@Override
51  	protected Objects.ToStringHelper getToStringHelper() {
52  		return super.getToStringHelper().
53  				add("description", description).
54  				add("iconUri", iconUri);
55  	}
56  
57  	@Override
58  	public boolean equals(Object obj) {
59  		if (obj instanceof IssueType) {
60  			IssueType that = (IssueType) obj;
61  			return super.equals(obj)
62  					&& Objects.equal(this.description, that.description)
63  					&& Objects.equal(this.iconUri, that.iconUri);
64  		}
65  		return false;
66  	}
67  
68  	@Override
69  	public int hashCode() {
70  		return Objects.hashCode(super.hashCode(), description, iconUri);
71  	}
72  
73  }