org.jdesktop.binding.metadata
Class EnumeratedMetaData

java.lang.Object
  extended by org.jdesktop.binding.metadata.MetaData
      extended by org.jdesktop.binding.metadata.EnumeratedMetaData

public class EnumeratedMetaData
extends MetaData

Class for representing meta-data for data fields which have a finite set of possible values. The type of each value in the enumeration must match the type ("elementClass" property) of the meta-data object. Example usage:


     String weekdays[] = {"Sunday","Monday","Tuesday","Wednesday",
                          "Thursday","Friday","Saturday"};
     EnumeratedMetaData metaData = new EnumeratedMetaData("weekday", String.class,
                                                          "Day of Week");
     metaData.setEnumeration(weekdays);
 

Version:
1.0
Author:
Amy Fowler

Field Summary
protected  java.lang.Object[] enumeration
           
 
Fields inherited from class org.jdesktop.binding.metadata.MetaData
converter, customProps, decodeFormat, displayWidth, encodeFormat, klass, label, maxValueCount, minValueCount, name, pcs, readOnly, validators
 
Constructor Summary
EnumeratedMetaData()
          Instantiates a meta-data object with a default name "enumvalue" and a default field class equal to java.lang.String.
EnumeratedMetaData(java.lang.String name)
          Instantiates a meta-data object with the specified name and a default field class equal to java.lang.String.
EnumeratedMetaData(java.lang.String name, java.lang.Class klass)
          Instantiates a meta-data object with the specified name and field class.
EnumeratedMetaData(java.lang.String name, java.lang.Class klass, java.lang.String label)
          Instantiates a meta-data object with the specified name, field class, and label.
 
Method Summary
 java.lang.Object[] getEnumeration()
          Gets the meta-data "enumeration" property which contains the set of possible values for the associated data field.
 void setEnumeration(java.util.List enumeration)
          Sets the meta-data "enumeration" property by copying the values contained in the specified list to an internal representation.
 void setEnumeration(java.lang.Object[] enumeration)
          Sets the meta-data "enumeration" property by copying the values contained in the specified array to an internal representation.
 
Methods inherited from class org.jdesktop.binding.metadata.MetaData
addPropertyChangeListener, addValidator, firePropertyChange, firePropertyChange, firePropertyChange, getConverter, getCustomProperty, getCustomProperty, getCustomPropertyKeys, getDecodeFormat, getDisplayWidth, getElementClass, getEncodeFormat, getLabel, getMaxValueCount, getMinValueCount, getName, getPropertyChangeListeners, getValidators, isReadOnly, isRequired, removeCustomProperty, removePropertyChangeListener, removeValidator, setConverter, setCustomProperty, setDecodeFormat, setDisplayWidth, setElementClass, setEncodeFormat, setLabel, setMaxValueCount, setMinValueCount, setName, setReadOnly, setRequired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enumeration

protected java.lang.Object[] enumeration
Constructor Detail

EnumeratedMetaData

public EnumeratedMetaData()
Instantiates a meta-data object with a default name "enumvalue" and a default field class equal to java.lang.String. This provides the no-argument constructor required for JavaBeans. It is recommended that the program explicitly set a meaningful "name" property.


EnumeratedMetaData

public EnumeratedMetaData(java.lang.String name)
Instantiates a meta-data object with the specified name and a default field class equal to java.lang.String.

Parameters:
name - String containing the name of the data field

EnumeratedMetaData

public EnumeratedMetaData(java.lang.String name,
                          java.lang.Class klass)
Instantiates a meta-data object with the specified name and field class.

Parameters:
name - String containing the name of the data field
klass - Class indicating type of data field

EnumeratedMetaData

public EnumeratedMetaData(java.lang.String name,
                          java.lang.Class klass,
                          java.lang.String label)
Instantiates a meta-data object with the specified name, field class, and label.

Parameters:
name - String containing the name of the data field
klass - Class indicating type of data field
label - String containing the user-displayable label for the data field
Method Detail

getEnumeration

public java.lang.Object[] getEnumeration()
Gets the meta-data "enumeration" property which contains the set of possible values for the associated data field. The returned array is a copy, therefore modifications to that array will have no affect on the property.

Returns:
array containing 0 or more enumerated values for the data field
See Also:
setEnumeration(java.lang.Object[])

setEnumeration

public void setEnumeration(java.lang.Object[] enumeration)
Sets the meta-data "enumeration" property by copying the values contained in the specified array to an internal representation.

Parameters:
enumeration - array containing 0 or more enumerated values for the data field
See Also:
getEnumeration()

setEnumeration

public void setEnumeration(java.util.List enumeration)
Sets the meta-data "enumeration" property by copying the values contained in the specified list to an internal representation.

Parameters:
enumeration - list containing 0 or more enumerated values for the data field
See Also:
getEnumeration()


Copyright © 2005 Sun Microsystems All Rights Reserved.