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.api.domain;
18  
19  import com.atlassian.jira.rest.client.api.IdentifiableEntity;
20  import com.google.common.base.Objects;
21  
22  import java.net.URI;
23  
24  /**
25   * Basic information (served together with the issue) about current resolution.
26   *
27   * @since v0.1
28   */
29  public class Resolution extends AddressableNamedEntity implements IdentifiableEntity<Long> {
30  	private final Long id;
31  	private final String description;
32  
33  	public Resolution(final URI self, final Long id, final String name, final String description) {
34  		super(self, name);
35  		this.id = id;
36  		this.description = description;
37  	}
38  
39  	public Long getId() {
40  		return id;
41  	}
42  
43  	public String getDescription() {
44  		return description;
45  	}
46  
47  	@Override
48  	public String toString() {
49  		return getToStringHelper().
50  				add("id", id).
51  				add("description", description).
52  				toString();
53  	}
54  
55  	@Override
56  	public boolean equals(Object obj) {
57  		if (obj instanceof Resolution) {
58  			Resolution that = (Resolution) obj;
59  			return super.equals(obj)
60  					&& Objects.equal(this.id, that.id)
61  					&& Objects.equal(this.description, that.description);
62  		}
63  		return false;
64  	}
65  
66  	@Override
67  	public int hashCode() {
68  		return Objects.hashCode(super.hashCode(), id, description);
69  	}
70  }