1 /******************************************************************************* 2 * Copyright 2012 Internet2 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 * $Header: /home/hagleyj/i2mi/grouper-misc/grouperClient/src/ext/edu/internet2/middleware/grouperClientExt/org/apache/commons/httpclient/NameValuePair.java,v 1.1 2008-11-30 10:57:19 mchyzer Exp $ 18 * $Revision: 1.1 $ 19 * $Date: 2008-11-30 10:57:19 $ 20 * 21 * ==================================================================== 22 * 23 * Licensed to the Apache Software Foundation (ASF) under one or more 24 * contributor license agreements. See the NOTICE file distributed with 25 * this work for additional information regarding copyright ownership. 26 * The ASF licenses this file to You under the Apache License, Version 2.0 27 * (the "License"); you may not use this file except in compliance with 28 * the License. You may obtain a copy of the License at 29 * 30 * http://www.apache.org/licenses/LICENSE-2.0 31 * 32 * Unless required by applicable law or agreed to in writing, software 33 * distributed under the License is distributed on an "AS IS" BASIS, 34 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 * See the License for the specific language governing permissions and 36 * limitations under the License. 37 * ==================================================================== 38 * 39 * This software consists of voluntary contributions made by many 40 * individuals on behalf of the Apache Software Foundation. For more 41 * information on the Apache Software Foundation, please see 42 * <http://www.apache.org/>. 43 * 44 */ 45 46 package edu.internet2.middleware.grouperInstallerExt.org.apache.commons.httpclient; 47 48 import java.io.Serializable; 49 50 import edu.internet2.middleware.grouperInstallerExt.org.apache.commons.httpclient.util.LangUtils; 51 52 /** 53 * <p>A simple class encapsulating a name/value pair.</p> 54 * 55 * @author <a href="mailto:bcholmes@interlog.com">B.C. Holmes</a> 56 * @author Sean C. Sullivan 57 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a> 58 * 59 * @version $Revision: 1.1 $ $Date: 2008-11-30 10:57:19 $ 60 * 61 */ 62 public class NameValuePair implements Serializable { 63 64 // ----------------------------------------------------------- Constructors 65 66 /** 67 * Default constructor. 68 * 69 */ 70 public NameValuePair() { 71 this (null, null); 72 } 73 74 /** 75 * Constructor. 76 * @param name The name. 77 * @param value The value. 78 */ 79 public NameValuePair(String name, String value) { 80 this.name = name; 81 this.value = value; 82 } 83 84 // ----------------------------------------------------- Instance Variables 85 86 /** 87 * Name. 88 */ 89 private String name = null; 90 91 /** 92 * Value. 93 */ 94 private String value = null; 95 96 // ------------------------------------------------------------- Properties 97 98 /** 99 * Set the name. 100 * 101 * @param name The new name 102 * @see #getName() 103 */ 104 public void setName(String name) { 105 this.name = name; 106 } 107 108 109 /** 110 * Return the name. 111 * 112 * @return String name The name 113 * @see #setName(String) 114 */ 115 public String getName() { 116 return name; 117 } 118 119 120 /** 121 * Set the value. 122 * 123 * @param value The new value. 124 */ 125 public void setValue(String value) { 126 this.value = value; 127 } 128 129 130 /** 131 * Return the current value. 132 * 133 * @return String value The current value. 134 */ 135 public String getValue() { 136 return value; 137 } 138 139 // --------------------------------------------------------- Public Methods 140 141 /** 142 * Get a String representation of this pair. 143 * @return A string representation. 144 */ 145 public String toString() { 146 return ("name=" + name + ", " + "value=" + value); 147 } 148 149 public boolean equals(final Object object) { 150 if (object == null) return false; 151 if (this == object) return true; 152 if (object instanceof NameValuePair) { 153 NameValuePair/../../../../../../edu/internet2/middleware/grouperInstallerExt/org/apache/commons/httpclient/NameValuePair.html#NameValuePair">NameValuePair that = (NameValuePair) object; 154 return LangUtils.equals(this.name, that.name) 155 && LangUtils.equals(this.value, that.value); 156 } else { 157 return false; 158 } 159 } 160 161 public int hashCode() { 162 int hash = LangUtils.HASH_SEED; 163 hash = LangUtils.hashCode(hash, this.name); 164 hash = LangUtils.hashCode(hash, this.value); 165 return hash; 166 } 167 }