public abstract class FlatFieldFormatSupport extends Object implements FlatFieldFormat
FlatFieldFormat implementations.| Constructor and Description |
|---|
FlatFieldFormatSupport() |
| Modifier and Type | Method and Description |
|---|---|
String |
extract(UnmarshallingContext context,
boolean reporting)
Extracts the field text from a record.
|
protected abstract String |
extractFieldText(UnmarshallingContext context,
boolean reporting) |
String |
getName()
Returns the field name.
|
FieldPadding |
getPadding()
Returns the field padding.
|
int |
getPosition()
Returns the field position.
|
int |
getSize()
Returns the size of the field.
|
int |
getUntil() |
void |
insertField(MarshallingContext context,
String text)
Inserts field text into a record.
|
protected abstract void |
insertFieldText(MarshallingContext context,
String text,
boolean commit) |
boolean |
insertValue(MarshallingContext context,
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.
|
void |
setLazy(boolean lazy) |
void |
setName(String name)
Sets the field name.
|
void |
setPadding(FieldPadding padding)
Sets the field padding.
|
void |
setPosition(int position) |
void |
setUntil(int until) |
String |
toString() |
public boolean insertValue(MarshallingContext context, Object value)
FieldFormatFieldFormat.insertField(MarshallingContext, String)
is called. If the method returns true, FieldFormat.insertField(MarshallingContext, String)
is not invoked.insertValue in interface FieldFormatcontext - the MarshallingContextvalue - the value to insert into the recordFieldFormat.insertField(MarshallingContext, String)
must be invoked, false otherwisepublic void insertField(MarshallingContext context, String text)
insertField in interface FieldFormatcontext - the MarshallingContext holding the recordtext - the field text to insert into the recordprotected abstract void insertFieldText(MarshallingContext context, String text, boolean commit)
public String extract(UnmarshallingContext context, boolean reporting)
FieldFormatMay return Value.INVALID if the field is invalid, or Value.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.
extract in interface FieldFormatcontext - the UnmarshallingContext holding the recordprotected abstract String extractFieldText(UnmarshallingContext context, boolean reporting)
public String getName()
public void setName(String name)
name - the field namepublic int getPosition()
FlatFieldFormatIn a delimited/CSV stream format, the position is the index of the field in the record starting at 0. For example, the position of field2 in the following comma delimited record is 1:
field1,field2,field3
In a fixed length stream format, the position is the index of the first character of the field in the record, also starting at 0. For example, the position of field2 in the following record is 6:
field1field2field3
getPosition in interface FlatFieldFormatpublic void setPosition(int position)
public int getUntil()
public void setUntil(int until)
public int getSize()
FieldFormatgetSize in interface FieldFormatpublic boolean isNillable()
FieldFormatisNillable in interface FieldFormatpublic FieldPadding getPadding()
FieldPaddingpublic void setPadding(FieldPadding padding)
padding - the FieldPaddingpublic boolean isLazy()
FieldFormatisLazy in interface FieldFormatpublic void setLazy(boolean lazy)