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.NamedEntity;
20  import com.google.common.base.Objects;
21  
22  /**
23   * Cookie used for maintaining the session for this user
24   *
25   * @since v0.1
26   */
27  public class SessionCookie implements NamedEntity {
28  	private final String name;
29  	private final String value;
30  
31  	public SessionCookie(String name, String value) {
32  		this.name = name;
33  		this.value = value;
34  	}
35  
36  	public String getName() {
37  		return name;
38  	}
39  
40  	public String getValue() {
41  		return value;
42  	}
43  
44  	@Override
45  	public String toString() {
46  		return Objects.toStringHelper(this).addValue(super.toString()).
47  				add("name", name).
48  				add("value", value).
49  				toString();
50  	}
51  
52  	@Override
53  	public boolean equals(Object obj) {
54  		if (obj instanceof SessionCookie) {
55  			SessionCookie that = (SessionCookie) obj;
56  			return Objects.equal(this.name, that.name)
57  					&& Objects.equal(this.value, that.value);
58  		}
59  		return false;
60  	}
61  
62  	@Override
63  	public int hashCode() {
64  		return Objects.hashCode(name, value);
65  	}
66  
67  }