public class EnumFieldDesc extends FieldDesc<java.lang.String>
Constructor and Description |
---|
EnumFieldDesc()
Default constructor with no arguments, useful for cases where the
descriptor is configured from XML elements.
|
EnumFieldDesc(java.lang.String fieldName,
java.util.Set<java.lang.String> values)
Constructor taking a field name and collection of values.
|
Modifier and Type | Method and Description |
---|---|
DataType |
getFieldType()
Get the field type for this field description
|
java.util.Set<java.lang.String> |
getValidValues()
Get the set of values allowed by this descriptor.
|
boolean |
isValid(java.lang.String value)
Return whether a field value is valid.
|
java.lang.String |
parse(java.lang.String stringVal)
Parse the value into the format for this field description.
|
java.lang.String |
parseValueIntoRecord(DataRecord rec,
java.lang.String value)
Parse the string value, and store it in an enumerated value field in the
specified data record.
|
protected void |
setValues(org.w3c.dom.NodeList valueList)
Set the values for this Enumerated field description.
|
void |
storeDefaultIntoRecord(DataRecord rec)
Store the default value into the data record provided.
|
org.w3c.dom.Element |
toXml(org.w3c.dom.Document doc)
Convert this field description to an XML Element.
|
addSourceField, applyTransform, getDefaultValue, getFieldName, getLookupIndexField, getLookupTable, getLookupValueField, getSourceFields, getTransform, isMultiValue, loadFromXml, setDefaultValue, setFieldName, setMultiValue
public EnumFieldDesc()
public EnumFieldDesc(java.lang.String fieldName, java.util.Set<java.lang.String> values)
fieldName
- the field name for this descriptorvalues
- the allowed values for the descriptorpublic DataType getFieldType()
getFieldType
in class FieldDesc<java.lang.String>
public java.util.Set<java.lang.String> getValidValues()
public boolean isValid(java.lang.String value)
public java.lang.String parse(java.lang.String stringVal)
public java.lang.String parseValueIntoRecord(DataRecord rec, java.lang.String value)
parseValueIntoRecord
in class FieldDesc<java.lang.String>
rec
- the DataRecord to parse the value intovalue
- the String value to be parsedjava.lang.IllegalArgumentException
- if the value is not a valid value of
this Enumerated Value fieldprotected void setValues(org.w3c.dom.NodeList valueList)
value
to set the list
of values used for this enumerated field.public void storeDefaultIntoRecord(DataRecord rec)
storeDefaultIntoRecord
in class FieldDesc<java.lang.String>
rec
- the DataRecord to store the value intopublic org.w3c.dom.Element toXml(org.w3c.dom.Document doc)
fieldDef
element, sets the fieldName and fieldType, and
creates a values child element. The values element contains all valid
values for this enumerated field, in separate value
tags.
If the default value is set, this method adds it as well.