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 FieldFormat
AFieldFormat
provides format specific processing for aField
parser.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.String
extract(UnmarshallingContext context, boolean reportErrors)
Extracts the field text from a record.int
getSize()
Returns the size of the field.void
insertField(MarshallingContext context, java.lang.String text)
Inserts field text into a record.boolean
insertValue(MarshallingContext context, java.lang.Object value)
Inserts a value into a record.boolean
isLazy()
TODO rename isLazy to something better?? Returns whether this field is optionally present in the record.boolean
isNillable()
Returns whether this field is nillable.
-
-
-
Method Detail
-
extract
java.lang.String extract(UnmarshallingContext context, boolean reportErrors)
Extracts the field text from a record. Returnsnull
if the field was not present in the record.May return
Value.INVALID
if the field is invalid, orValue.NIL
if 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
- theUnmarshallingContext
holding 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
- theMarshallingContext
value
- 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
- theMarshallingContext
holding 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
-
-