org.gjt.btools.utilities
Class ExtendedObject

java.lang.Object
  |
  +--org.gjt.btools.utilities.ExtendedObject

public final class ExtendedObject
extends java.lang.Object

Stores an object and a corresponding text description. This can be used in list boxes, combo boxes and the like where the program needs to store some underlying value but the user interface should display a friendly description. Routine toString() has been overridden to behave properly in these circumstances.


Constructor Summary
ExtendedObject(java.lang.Object value, java.lang.String desc)
          Creates a new extended object.
 
Method Summary
 java.lang.String getDescription()
          Returns the text description associated with this object.
 java.lang.Object getValue()
          Returns the underlying value stored with this object.
 void setDescription(java.lang.String desc)
          Sets the text description associated with this object.
 void setValue(java.lang.Object value)
          Sets the underlying value stored with this object.
 java.lang.String toString()
          Returns the text description associated with this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtendedObject

public ExtendedObject(java.lang.Object value,
                      java.lang.String desc)
Creates a new extended object.

Parameters:
value - the underlying value to store.
desc - the corresponding text description.
Method Detail

getValue

public java.lang.Object getValue()
Returns the underlying value stored with this object.

Returns:
the underlying value.

setValue

public void setValue(java.lang.Object value)
Sets the underlying value stored with this object.

Parameters:
value - the new underlying value to store.

getDescription

public java.lang.String getDescription()
Returns the text description associated with this object.

Returns:
the text description.

setDescription

public void setDescription(java.lang.String desc)
Sets the text description associated with this object.

Parameters:
desc - the new text description.

toString

public java.lang.String toString()
Returns the text description associated with this object. If the description is null, this routine will return value.toString() where value is the underlying value stored.

Overrides:
toString in class java.lang.Object
Returns:
the description for this object.


Copyright © 1998-2001, Ben Burton
This software is released under the GNU Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).