Expresso 5-5-0

com.jcorporate.expresso.core.dbobj
Class ValidValue

java.lang.Object
  extended bycom.jcorporate.expresso.core.dbobj.ValidValue
All Implemented Interfaces:
Cacheable, Serializable
Direct Known Subclasses:
ISOValidValue

public class ValidValue
extends Object
implements Cacheable

A valid value is a enumerated collection very similar to a pure Struts label and value bean. It typically represent an item of data that is displayed in a drop-down list box or a menu selection. A valid value has a real value as known as a key and description.

To support internationalisation (i18n) the look at the subclass ISOValidValue.

This class also contains two very useful static inner classes ValueComparator and DescriptionComparator, which are useful for supporting Java collection objects that contain ValidValue types.

Version:
$Id: ValidValue.java,v 1.8 2003/08/10 12:53:41 rimovm Exp $
Author:
Peter A. Pilgrim, Fri Dec 27 22:33:27 GMT 2002
See Also:
ISOValidValue, Serialized Form

Nested Class Summary
static class ValidValue.DescriptionComparator
          A simple comparator for comparing the description attribute of ValidValue records.
static class ValidValue.ValueComparator
          A simple comparator for comparing the value attribute of ValidValue records.
 
Field Summary
protected  String description
           
protected  String value
           
 
Constructor Summary
ValidValue()
          Default constructor for creating a valid value.
ValidValue(String newValue, String newDescrip)
          Original constructor for creating a valid value.
 
Method Summary
 String getDescription()
          Gets the description of the valid value
 String getKey()
          Gets the real value of the valid value as a cache key
 String getValue()
          Gets the real value of the valid value
 int hashCode()
          Hashcode since we store by key
 void setDescription(String newDescription)
          Sets the real description of the valid value
 void setValue(String newValue)
          Sets the real value of the valid value
 String toString()
          Human readable string for debugging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected String value

description

protected String description
Constructor Detail

ValidValue

public ValidValue()
Default constructor for creating a valid value. Please note: no canonization takes place within this method.


ValidValue

public ValidValue(String newValue,
                  String newDescrip)
Original constructor for creating a valid value. Please note: no canonization takes place within this method.

Parameters:
newValue - the real value of the enumeration
newDescrip - the description of the enumeration
Method Detail

getValue

public String getValue()
Gets the real value of the valid value

Returns:
the value string
See Also:
setValue(java.lang.String)

setValue

public void setValue(String newValue)
Sets the real value of the valid value

See Also:
getValue()

getKey

public String getKey()
Gets the real value of the valid value as a cache key

Specified by:
getKey in interface Cacheable
Returns:
the value string as a cache key
See Also:
getValue()

hashCode

public int hashCode()
Hashcode since we store by key

Returns:
integer

getDescription

public String getDescription()
Gets the description of the valid value

Returns:
the description

setDescription

public void setDescription(String newDescription)
Sets the real description of the valid value

See Also:
getDescription()

toString

public String toString()
Human readable string for debugging


Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.