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