Package org.beanio.internal.parser
Interface FieldFormat
-
- All Known Subinterfaces:
FlatFieldFormat
- All Known Implementing Classes:
DelimitedFieldFormat,FixedLengthFieldFormat,FlatFieldFormatSupport,JsonFieldFormat,XmlAttributeField,XmlElementField,XmlFieldFormat,XmlTextField
public interface FieldFormatAFieldFormatprovides format specific processing for aFieldparser.Implementations of this interface must be thread-safe.
- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringextract(UnmarshallingContext context, boolean reportErrors)Extracts the field text from a record.intgetSize()Returns the size of the field.voidinsertField(MarshallingContext context, java.lang.String text)Inserts field text into a record.booleaninsertValue(MarshallingContext context, java.lang.Object value)Inserts a value into a record.booleanisLazy()TODO rename isLazy to something better?? Returns whether this field is optionally present in the record.booleanisNillable()Returns whether this field is nillable.
-
-
-
Method Detail
-
extract
java.lang.String extract(UnmarshallingContext context, boolean reportErrors)
Extracts the field text from a record. Returnsnullif the field was not present in the record.May return
Value.INVALIDif the field is invalid, orValue.NILif the field is explicitly set to nil or null such as in an XML or JSON formatted stream.Implementations should also remove any field padding before returning the text.
- Parameters:
context- theUnmarshallingContextholding the record- Returns:
- the field text
-
insertValue
boolean insertValue(MarshallingContext context, java.lang.Object value)
Inserts a value into a record. This method is called before type conversion. If the method returns false, type conversion is invoked andinsertField(MarshallingContext, String)is called. If the method returns true,insertField(MarshallingContext, String)is not invoked.- Parameters:
context- theMarshallingContextvalue- the value to insert into the record- Returns:
- true if type conversion is required and
insertField(MarshallingContext, String)must be invoked, false otherwise
-
insertField
void insertField(MarshallingContext context, java.lang.String text)
Inserts field text into a record.- Parameters:
context- theMarshallingContextholding the recordtext- the field text to insert into the record
-
getSize
int getSize()
Returns the size of the field. Fixed length formats should return the field length, while other formats should simply return 1.- Returns:
- the size of the field
-
isNillable
boolean isNillable()
Returns whether this field is nillable.- Returns:
- true if nillable, false otherwise
-
isLazy
boolean isLazy()
TODO rename isLazy to something better?? Returns whether this field is optionally present in the record.- Returns:
- true if lazy, false otherwise
-
-