public class FixedLengthFieldFormat extends FlatFieldFormatSupport implements FieldFormat
FieldFormat
implementation for a field in a fixed length formatted stream.Constructor and Description |
---|
FixedLengthFieldFormat()
Constructs a new FixedLengthFieldFormat.
|
Modifier and Type | Method and Description |
---|---|
String |
extract(UnmarshallingContext context,
boolean reportErrors)
Extracts the field text from a record.
|
String |
extractFieldText(UnmarshallingContext context,
boolean reporting) |
int |
getSize()
Returns the size of the field.
|
void |
insertFieldText(MarshallingContext context,
String fieldText,
boolean commit) |
void |
setKeepPadding(boolean keepPadding)
Set to true to keep field padding during unmarshalling.
|
void |
setLenientPadding(boolean lenientPadding)
Sets whether the padding length is enforced.
|
getName, getPadding, getPosition, getUntil, insertField, insertValue, isLazy, isNillable, setLazy, setName, setPadding, setPosition, setUntil, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
insertField, insertValue, isLazy, isNillable
public FixedLengthFieldFormat()
public String extract(UnmarshallingContext context, boolean reportErrors)
FieldFormat
May 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 FieldFormat
extract
in class FlatFieldFormatSupport
context
- the UnmarshallingContext
holding the recordpublic String extractFieldText(UnmarshallingContext context, boolean reporting)
extractFieldText
in class FlatFieldFormatSupport
public void insertFieldText(MarshallingContext context, String fieldText, boolean commit)
insertFieldText
in class FlatFieldFormatSupport
public int getSize()
FieldFormat
getSize
in interface FieldFormat
getSize
in class FlatFieldFormatSupport
public void setKeepPadding(boolean keepPadding)
keepPadding
- true to keep paddingpublic void setLenientPadding(boolean lenientPadding)
lenientPadding
- true if not enforced, false otherwise