org.enhydra.zeus.transform
Class ValueEnumeration

java.lang.Object
  |
  +--org.enhydra.zeus.transform.ValueEnumeration

public class ValueEnumeration
extends java.lang.Object

ValueEnumeration represents a set of allowed values for a class or other construct to be allowed to take on. Even though the values may ultimately be represented by Java ints, Dates, or other non-character-based types, all data in this class is represented by Java Strings, and later converted to appropriate types.

Author:
Brett McLaughlin

Constructor Summary
ValueEnumeration(java.lang.String name)
           Default constructor.
ValueEnumeration(java.lang.String name, java.util.List allowedValues)
           This constructor creates a new ValueEnumeration using the supplied List to seed the allowed values.
 
Method Summary
 void addAllowedValue(java.lang.String allowedValue)
           This will add a new allowed value to the current list.
 java.util.List getAllowedValues()
           This returns the current list of allowed values.
 java.lang.String getName()
           This will return the current name of this ValueEnumeration.
 boolean isAllowedValue(java.lang.String value)
           This will indicate if the supplied value is allowed for this ValueEnumeration.
 void removeAllowedValue(java.lang.String removedValue)
           This will remove the specified value from the current list.
 void setAllowedValues(java.util.List allowedValues)
           This sets the list of allowed values to the supplied List.
 void setName(java.lang.String name)
           This will set the name of this ValueEnumeration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueEnumeration

public ValueEnumeration(java.lang.String name)

Default constructor.

Parameters:
name - the name of this enumeration.

ValueEnumeration

public ValueEnumeration(java.lang.String name,
                        java.util.List allowedValues)

This constructor creates a new ValueEnumeration using the supplied List to seed the allowed values.

Parameters:
name - the name of this enumeration.
allowedValue - initial values to allow for this enumeration.
Method Detail

setName

public void setName(java.lang.String name)

This will set the name of this ValueEnumeration.

Parameters:
name - the name for this enumeration

getName

public java.lang.String getName()

This will return the current name of this ValueEnumeration.

Returns:
String - the name of this enumeration.

setAllowedValues

public void setAllowedValues(java.util.List allowedValues)

This sets the list of allowed values to the supplied List. Any existing allowed values are replaced. If any value is allowed, the null value should be supplied here.

Parameters:
allowedValues - the values to allow for this enumeration.

getAllowedValues

public java.util.List getAllowedValues()

This returns the current list of allowed values.

Returns:
List - the list of allowed values.

addAllowedValue

public void addAllowedValue(java.lang.String allowedValue)

This will add a new allowed value to the current list.

Parameters:
allowedValue - the new value to allow

removeAllowedValue

public void removeAllowedValue(java.lang.String removedValue)

This will remove the specified value from the current list.

Parameters:
removedValue - the value to remove from the enumeration.

isAllowedValue

public boolean isAllowedValue(java.lang.String value)

This will indicate if the supplied value is allowed for this ValueEnumeration.

Note that this operation is case-sensitive; while this is not relevant if the data is numerical or non-character-based, it will affect this operation on character-based values.

Parameters:
value - the value to check for legality in this enumeration.
Returns:
boolean - whether the supplied value is allowed.


Copyright © 2001 Enhydra. All Rights Reserved.