BeanIO 1.2.3

org.beanio.parser.xml
Class XmlFieldDefinition

java.lang.Object
  extended by org.beanio.parser.PropertyDefinition
      extended by org.beanio.parser.FieldDefinition
          extended by org.beanio.parser.xml.XmlFieldDefinition
All Implemented Interfaces:
XmlNode

public class XmlFieldDefinition
extends FieldDefinition
implements XmlNode

Field definition implementation for XML formatted streams.

Since:
1.1
Author:
Kevin Seim

Field Summary
 
Fields inherited from class org.beanio.parser.FieldDefinition
LEFT, RIGHT
 
Fields inherited from class org.beanio.parser.PropertyDefinition
INVALID, MISSING
 
Constructor Summary
XmlFieldDefinition()
          Constructs a new XmlFieldDefinition.
 
Method Summary
protected  String formatPaddedNull()
          Overridden to return null when a padded optional field is null.
protected  String formatText(String text)
          Formats field text.
 XmlDefinition getXmlDefinition()
          Returns the XML attributes that define this node.
protected  boolean isNilSupported()
          Returns whether FieldDefinition.formatValue(Object) may return TypeHandler.NIL.
 boolean matches(Record record)
          Tests if the field text in the record matches this field definition.
protected  String parseField(Record record)
          Parses the raw field text from a record prior to any validation and sets the text on the record.
protected  Object parsePropertyValue(Record record, String fieldText)
          Parses and validates a field property value from the given field text.
 
Methods inherited from class org.beanio.parser.FieldDefinition
defines, formatValue, getDefaultTextFor, getDefaultValue, getJustification, getLiteral, getMaxLength, getMinLength, getPaddedLength, getPadding, getPosition, getRegex, getRegexPattern, getTypeHandler, isField, isMatch, isMatch, isPadded, isProperty, isRequired, isTrim, parsePropertyValue, setDefaultValue, setJustification, setLiteral, setMaxLength, setMinLength, setPadded, setPaddedLength, setPadding, setPosition, setProperty, setPropertyType, setRegex, setRequired, setTrim, setTypeHandler, unpad
 
Methods inherited from class org.beanio.parser.PropertyDefinition
getCollectionType, getLength, getMaxOccurs, getMinOccurs, getName, getParent, getPropertyDescriptor, getPropertyType, isArray, isBean, isCollection, isConstant, isLazy, isRecordIdentifier, parseValue, setCollectionType, setLazy, setLength, setMaxOccurs, setMinOccurs, setName, setParent, setPropertyDescriptor, setRecordIdentifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlFieldDefinition

public XmlFieldDefinition()
Constructs a new XmlFieldDefinition.

Method Detail

matches

public boolean matches(Record record)
Description copied from class: FieldDefinition
Tests if the field text in the record matches this field definition.

Specified by:
matches in class FieldDefinition
Parameters:
record - the record containing the field to test
Returns:
true if the text is a match

parseField

protected String parseField(Record record)
Description copied from class: FieldDefinition
Parses the raw field text from a record prior to any validation and sets the text on the record.

Specified by:
parseField in class FieldDefinition
Parameters:
record - the record to parse
Returns:
the parsed field text, or PropertyDefinition.INVALID if the field is invalid, or null if the field is not present in the record

parsePropertyValue

protected Object parsePropertyValue(Record record,
                                    String fieldText)
Description copied from class: FieldDefinition
Parses and validates a field property value from the given field text.

Overrides:
parsePropertyValue in class FieldDefinition
Parameters:
record - the record being parsed
fieldText - the field text to parse
Returns:
the parsed field value, or PropertyDefinition.INVALID if the field was invalid, or PropertyDefinition.MISSING if the field was not present in the record

formatText

protected String formatText(String text)
Description copied from class: FieldDefinition
Formats field text. If the padded length of this field is greater than 0, text will be truncated if it exceeds the length, or padded with the padding character if it doesn't.

Overrides:
formatText in class FieldDefinition
Parameters:
text - the field text to format
Returns:
the formatted field text

isNilSupported

protected boolean isNilSupported()
Description copied from class: FieldDefinition
Returns whether FieldDefinition.formatValue(Object) may return TypeHandler.NIL. Returns false by default, which will convert TypeHandler.NIL to null.

Overrides:
isNilSupported in class FieldDefinition
Returns:
true if FieldDefinition.formatValue(Object) may return TypeHandler.NIL.

formatPaddedNull

protected String formatPaddedNull()
Overridden to return null when a padded optional field is null.

Overrides:
formatPaddedNull in class FieldDefinition
Returns:
field text for a null property

getXmlDefinition

public XmlDefinition getXmlDefinition()
Description copied from interface: XmlNode
Returns the XML attributes that define this node.

Specified by:
getXmlDefinition in interface XmlNode
Returns:
the XML attribute definition

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim