View Javadoc

1   /*
2    * Copyright (C) 2012 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.google.common.base.Objects;
20  import org.joda.time.DateTime;
21  
22  /**
23   * Represents Issue change history group
24   *
25   * @since 0.6
26   */
27  public class ChangelogGroup {
28  	private final BasicUser author;
29  	private final DateTime created;
30  	private final Iterable<ChangelogItem> items;
31  
32  	public ChangelogGroup(BasicUser author, DateTime created, Iterable<ChangelogItem> items) {
33  		this.author = author;
34  		this.created = created;
35  		this.items = items;
36  	}
37  
38  	public BasicUser getAuthor() {
39  		return author;
40  	}
41  
42  	public DateTime getCreated() {
43  		return created;
44  	}
45  
46  	public Iterable<ChangelogItem> getItems() {
47  		return items;
48  	}
49  
50  	@Override
51  	public boolean equals(Object obj) {
52  		if (obj instanceof ChangelogGroup) {
53  			ChangelogGroup that = (ChangelogGroup) obj;
54  			return Objects.equal(this.author, that.author)
55  					&& Objects.equal(this.created, that.created)
56  					&& Objects.equal(this.items, that.items);
57  		}
58  		return false;
59  	}
60  
61  	@Override
62  	public int hashCode() {
63  		return Objects.hashCode(author, created, items);
64  	}
65  
66  	@Override
67  	public String toString() {
68  		return Objects.toStringHelper(this)
69  				.add("author", author)
70  				.add("created", created)
71  				.add("items", items)
72  				.toString();
73  	}
74  }