2004.04.29


com.jdc.util
Class NameValue

java.lang.Object
  |
  +--com.jdc.lang.Object
        |
        +--com.jdc.util.NameValue

public class NameValue
extends Object

NameValue represents a name/value pair. The name must be a String whereas the value may be any Java Object.

Version:
1.0
Author:
Jay Damon

Field Summary
 
Fields inherited from class com.jdc.lang.Object
string
 
Constructor Summary
NameValue(String name)
          Constructs a new NameValue object for the specified name.
NameValue(String name, Object value)
          Constructs a new NameValue object for the specified name and value pair.
 
Method Summary
 boolean equals(Object object)
          Compares this NameValue object to the specified object.
 String getName()
          Returns the name for the name/value pair.
 Object getValue()
          Returns the value for the name/value pair.
 int hashCode()
          Returns a hash code value for this NameValue object.
protected  void setName(String name)
          Sets the name for the name/value pair.
 void setValue(Object value)
          Sets the value for the name/value pair.
 String toString()
          Returns a String representing the value for this NameValue object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameValue

public NameValue(String name)
Constructs a new NameValue object for the specified name.


NameValue

public NameValue(String name,
                 Object value)
Constructs a new NameValue object for the specified name and value pair.

Method Detail

equals

public boolean equals(Object object)
Compares this NameValue object to the specified object. Returns true if the name for the specified name/value pair is equal to the name for this name/value pair.

Overrides:
equals in class Object
Returns:
True if a specified object is equal to this name/value pair.
False if the specified object is not equal to this name/value pair.

hashCode

public int hashCode()
Returns a hash code value for this NameValue object. This method is supported for the benefit of hashtables such as those provided by Hashtable.

Overrides:
hashCode in class Object
Returns:
A hash code value for this name/value pair.

getName

public String getName()
Returns the name for the name/value pair.

Returns:
The name for the name/value pair.

getValue

public Object getValue()
Returns the value for the name/value pair.

Returns:
The value for the name/value pair.

setName

protected void setName(String name)
Sets the name for the name/value pair.


setValue

public void setValue(Object value)
Sets the value for the name/value pair.


toString

public String toString()
Returns a String representing the value for this NameValue object. If the value for the name/value pair is null, a String value of "null" is returned.

Overrides:
toString in class Object
Returns:
A String representing the value for this NameValue object.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.