org.norther.tammi.acorn.util
Class KeyValue

java.lang.Object
  extended by org.norther.tammi.acorn.util.KeyValue
All Implemented Interfaces:
Serializable

public class KeyValue
extends Object
implements Serializable

A settable key value class.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
KeyValue()
          Constructs an empty key value.
KeyValue(String kv)
          Constructs a string key value.
KeyValue(String k, Object v)
          Constructs a specific key value.
 
Method Summary
 boolean equals(Object other)
           
 String getKey()
          Gets the key.
 String getString()
          Gets the string value.
 Object getValue()
          Gets the value.
 int hashCode()
           
 void setKey(String k)
          Sets the key.
 void setString(String s)
          Sets the string value.
 void setValue(Object v)
          Sets the value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyValue

public KeyValue()
Constructs an empty key value.


KeyValue

public KeyValue(String kv)
Constructs a string key value.

Parameters:
kv - the key value in string format.

KeyValue

public KeyValue(String k,
                Object v)
Constructs a specific key value.

Parameters:
k - the key.
v - the value.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

getKey

public String getKey()
Gets the key.

Returns:
the key.
Throws:
IllegalStateException - if not set.

setKey

public void setKey(String k)
Sets the key.

Parameters:
k - the key.
Throws:
NullPointerException - if null.

getValue

public Object getValue()
Gets the value.

Returns:
the value.
Throws:
IllegalStateException - if not set.

setValue

public void setValue(Object v)
Sets the value.

Parameters:
v - the valie.
Throws:
NullPointerException - if null.

getString

public String getString()
Gets the string value.

Returns:
the string value.
Throws:
IllegalStateException - if not set.

setString

public void setString(String s)
Sets the string value.

Parameters:
s - the valie.
Throws:
NullPointerException - if null.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004 The Norther Organization. All rights reserved.