voji.utils
Class ValueHolder

java.lang.Object
  |
  +--voji.utils.ValueHolder

public class ValueHolder
extends java.lang.Object

This class holds a value under a certain name. It seems to be the name Object, but it also contains the value Object. It's useful for Lists, ComboBoxes and Tables when you want the user to see "Eleven" but want to work with the result 11.
This could be also a replacement for voji.utils.choice, if it would work :-(


Field Summary
 java.lang.Object name
          The name Object
 java.lang.Object value
          The value Object
 
Constructor Summary
ValueHolder()
          Creates a new ValueHolder instance with null fields
ValueHolder(java.lang.Object initValue)
          Creates a "dummy" ValueHolder instance with a null name for comparations
ValueHolder(java.lang.Object initName, java.lang.Object initValue)
          Creates a new ValueHolder instance
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one
static java.lang.Object get(java.lang.Object valueHolder)
          A shorter way to access the value of a ValueHolder
 java.lang.String toString()
          Formats this Object as a String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.Object name
The name Object


value

public java.lang.Object value
The value Object

Constructor Detail

ValueHolder

public ValueHolder(java.lang.Object initName,
                   java.lang.Object initValue)
Creates a new ValueHolder instance

Parameters:
initName - the initial name
initValue - the initial value

ValueHolder

public ValueHolder(java.lang.Object initValue)
Creates a "dummy" ValueHolder instance with a null name for comparations

Parameters:
initValue - the initial value

ValueHolder

public ValueHolder()
Creates a new ValueHolder instance with null fields

Method Detail

toString

public java.lang.String toString()
Formats this Object as a String. It just returns name :-)

Overrides:
toString in class java.lang.Object
Returns:
the String representation of name

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one

Overrides:
equals in class java.lang.Object
Returns:
whether the values of the ValueHolders are equal

get

public static java.lang.Object get(java.lang.Object valueHolder)
A shorter way to access the value of a ValueHolder

Parameters:
valueHolder - the ValueHolder whose value is wanted
Returns:
((ValueHolder)valueHolder).value