Class FixedLengthFieldFormat

    • Constructor Detail

      • FixedLengthFieldFormat

        public FixedLengthFieldFormat()
    • Method Detail

      • extract

        public java.lang.String extract​(UnmarshallingContext context,
                                        boolean reportErrors)
        Description copied from interface: FieldFormat
        Extracts the field text from a record. Returns null if the field was not present in the record.

        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.

        Specified by:
        extract in interface FieldFormat
        Overrides:
        extract in class FlatFieldFormatSupport
        Parameters:
        context - the UnmarshallingContext holding the record
        Returns:
        the field text
      • getSize

        public int getSize()
        Description copied from interface: FieldFormat
        Returns the size of the field. Fixed length formats should return the field length, while other formats should simply return 1.
        Specified by:
        getSize in interface FieldFormat
        Overrides:
        getSize in class FlatFieldFormatSupport
        Returns:
        the size of the field
      • setKeepPadding

        public void setKeepPadding​(boolean keepPadding)
        Set to true to keep field padding during unmarshalling.
        Parameters:
        keepPadding - true to keep padding
        Since:
        2.0.2
      • setLenientPadding

        public void setLenientPadding​(boolean lenientPadding)
        Sets whether the padding length is enforced.
        Parameters:
        lenientPadding - true if not enforced, false otherwise
        Since:
        2.1.0