~s-friedemann/tomdroid/sshfs

« back to all changes in this revision

Viewing changes to lib/signpost/signpost-core/src/main/java/oauth/signpost/Parameter.java

  • Committer: Guilherme Salgado
  • Date: 2010-08-31 21:44:24 UTC
  • mfrom: (185.1.51 sync-ui)
  • mto: (185.1.54 sync-ui)
  • mto: This revision was merged to the branch mainline in revision 186.
  • Revision ID: salgado@canonical.com-20100831214424-06b64zz707lwpmcl
mergeĀ lp:~tomdroid-developers/sync-ui

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2008, 2009 Netflix, Matthias Kaeppler
2
 
 *
3
 
 * Licensed under the Apache License, Version 2.0 (the "License");
4
 
 * you may not use this file except in compliance with the License.
5
 
 * You may obtain a copy of the License at
6
 
 *
7
 
 *     http://www.apache.org/licenses/LICENSE-2.0
8
 
 *
9
 
 * Unless required by applicable law or agreed to in writing, software
10
 
 * distributed under the License is distributed on an "AS IS" BASIS,
11
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 
 * See the License for the specific language governing permissions and
13
 
 * limitations under the License.
14
 
 */
15
 
package oauth.signpost;
16
 
 
17
 
import java.util.Map;
18
 
 
19
 
/** A name/value pair. */
20
 
public class Parameter implements Map.Entry<String, String> {
21
 
 
22
 
    public Parameter(String key, String value) {
23
 
        this.key = key;
24
 
        this.value = value;
25
 
    }
26
 
 
27
 
    private final String key;
28
 
 
29
 
    private String value;
30
 
 
31
 
    public String getKey() {
32
 
        return key;
33
 
    }
34
 
 
35
 
    public String getValue() {
36
 
        return value;
37
 
    }
38
 
 
39
 
    public String setValue(String value) {
40
 
        try {
41
 
            return this.value;
42
 
        } finally {
43
 
            this.value = value;
44
 
        }
45
 
    }
46
 
 
47
 
    @Override
48
 
    public String toString() {
49
 
        return getKey() + '=' + getValue();
50
 
    }
51
 
 
52
 
    @Override
53
 
    public int hashCode() {
54
 
        final int prime = 31;
55
 
        int result = 1;
56
 
        result = prime * result + ((key == null) ? 0 : key.hashCode());
57
 
        result = prime * result + ((value == null) ? 0 : value.hashCode());
58
 
        return result;
59
 
    }
60
 
 
61
 
    @Override
62
 
    public boolean equals(Object obj) {
63
 
        if (this == obj)
64
 
            return true;
65
 
        if (obj == null)
66
 
            return false;
67
 
        if (getClass() != obj.getClass())
68
 
            return false;
69
 
        final Parameter that = (Parameter) obj;
70
 
        if (key == null) {
71
 
            if (that.key != null)
72
 
                return false;
73
 
        } else if (!key.equals(that.key))
74
 
            return false;
75
 
        if (value == null) {
76
 
            if (that.value != null)
77
 
                return false;
78
 
        } else if (!value.equals(that.value))
79
 
            return false;
80
 
        return true;
81
 
    }
82
 
}