org.beanio.parser.fixedlength
Class FixedLengthFieldDefinition
java.lang.Object
org.beanio.parser.PropertyDefinition
org.beanio.parser.FieldDefinition
org.beanio.parser.flat.FlatFieldDefinition
org.beanio.parser.fixedlength.FixedLengthFieldDefinition
public class FixedLengthFieldDefinition
- extends FlatFieldDefinition
A FixedLengthFieldDefinition is used to parse and format fields for
fixed length records.
- Since:
- 1.0
- Author:
- Kevin Seim
Method Summary |
protected String |
formatPaddedNull()
Overridden to return spaces filled to the padded length of the field. |
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. |
void |
setPaddedLength(int length)
Sets the padded length of this field. |
Methods inherited from class org.beanio.parser.FieldDefinition |
defines, formatText, formatValue, getDefaultTextFor, getDefaultValue, getJustification, getLiteral, getMaxLength, getMinLength, getPaddedLength, getPadding, getPosition, getRegex, getRegexPattern, getTypeHandler, isField, isMatch, isMatch, isNilSupported, isPadded, isProperty, isRequired, isTrim, parsePropertyValue, parsePropertyValue, setDefaultValue, setJustification, setLiteral, setMaxLength, setMinLength, setPadded, 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 |
FixedLengthFieldDefinition
public FixedLengthFieldDefinition()
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
formatPaddedNull
protected String formatPaddedNull()
- Overridden to return spaces filled to the padded length of the field.
- Overrides:
formatPaddedNull
in class FieldDefinition
- Returns:
- field text for a null property
setPaddedLength
public void setPaddedLength(int length)
- Description copied from class:
FieldDefinition
- Sets the padded length of this field. If set to 0, padding
is disabled.
- Overrides:
setPaddedLength
in class FieldDefinition
- Parameters:
length
- the new padded length of this field
Copyright © 2010-2012 Kevin Seim