Class FixedLengthRecordMapper<P>

  • Type Parameters:
    P - type of the record's payload
    All Implemented Interfaces:
    org.jeasy.batch.core.mapper.RecordMapper<java.lang.String,​P>, org.jeasy.batch.core.processor.RecordProcessor<java.lang.String,​P>

    public class FixedLengthRecordMapper<P>
    extends org.jeasy.batch.core.mapper.AbstractRecordMapper<P>
    implements org.jeasy.batch.core.mapper.RecordMapper<java.lang.String,​P>
    Fixed Length Record to Object mapper implementation.
    Author:
    Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEFAULT_WHITESPACE_TRIMMING  
      • Fields inherited from class org.jeasy.batch.core.mapper.AbstractRecordMapper

        objectMapper
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<org.jeasy.batch.flatfile.Field> parseRecord​(org.jeasy.batch.core.record.Record<java.lang.String> record)  
      org.jeasy.batch.core.record.Record<P> processRecord​(org.jeasy.batch.core.record.Record<java.lang.String> record)  
      void setTrimWhitespaces​(boolean trimWhitespaces)
      Trim white spaces when parsing the fixed length record.
      • Methods inherited from class org.jeasy.batch.core.mapper.AbstractRecordMapper

        registerTypeConverter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_WHITESPACE_TRIMMING

        public static final boolean DEFAULT_WHITESPACE_TRIMMING
        See Also:
        Constant Field Values
    • Constructor Detail

      • FixedLengthRecordMapper

        public FixedLengthRecordMapper​(java.lang.Class<P> recordClass,
                                       int[] fieldsLength,
                                       java.lang.String[] fieldNames)
        Create a new FixedLengthRecordMapper instance.
        Parameters:
        recordClass - the target domain object class
        fieldsLength - an array of fields length in the same order in the FLR flat file.
        fieldNames - a String array representing fields name in the same order in the FLR flat file.
    • Method Detail

      • processRecord

        public org.jeasy.batch.core.record.Record<P> processRecord​(org.jeasy.batch.core.record.Record<java.lang.String> record)
                                                            throws java.lang.Exception
        Specified by:
        processRecord in interface org.jeasy.batch.core.processor.RecordProcessor<java.lang.String,​P>
        Throws:
        java.lang.Exception
      • parseRecord

        protected java.util.List<org.jeasy.batch.flatfile.Field> parseRecord​(org.jeasy.batch.core.record.Record<java.lang.String> record)
                                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setTrimWhitespaces

        public void setTrimWhitespaces​(boolean trimWhitespaces)
        Trim white spaces when parsing the fixed length record.
        Parameters:
        trimWhitespaces - true if whitespaces should be trimmed