1 31 32 package org.apache.commons.httpclient; 33 34 import java.io.Serializable ; 35 36 46 public class NameValuePair implements Serializable { 47 48 50 54 public NameValuePair() { 55 this (null, null); 56 } 57 58 63 public NameValuePair(String name, String value) { 64 this.name = name; 65 this.value = value; 66 } 67 68 70 73 private String name = null; 74 75 78 private String value = null; 79 80 82 88 public void setName(String name) { 89 this.name = name; 90 } 91 92 93 99 public String getName() { 100 return name; 101 } 102 103 104 109 public void setValue(String value) { 110 this.value = value; 111 } 112 113 114 119 public String getValue() { 120 return value; 121 } 122 123 125 129 public String toString() { 130 return ("name=" + name + ", " + "value=" + value); 131 } 132 133 142 public boolean equals(Object object) { 143 if (this == object) { 144 return true; 145 } else if (this.getClass().equals(object.getClass())) { 146 NameValuePair pair = (NameValuePair) object; 147 return ((null == name ? null == pair.name : name.equals(pair.name)) 148 && (null == value ? null == pair.value : value.equals(pair.value))); 149 } else { 150 return false; 151 } 152 } 153 154 159 public int hashCode() { 160 return (this.getClass().hashCode() 161 ^ (null == name ? 0 : name.hashCode()) 162 ^ (null == value ? 0 : value.hashCode())); 163 } 164 165 178 } 179 | Popular Tags |