Package org.jeasy.batch.flatfile
Class FixedLengthRecordMapper<P>
- java.lang.Object
-
- org.jeasy.batch.core.mapper.AbstractRecordMapper<P>
-
- org.jeasy.batch.flatfile.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 booleanDEFAULT_WHITESPACE_TRIMMING
-
Constructor Summary
Constructors Constructor Description FixedLengthRecordMapper(java.lang.Class<P> recordClass, int[] fieldsLength, java.lang.String[] fieldNames)Create a newFixedLengthRecordMapperinstance.
-
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)voidsetTrimWhitespaces(boolean trimWhitespaces)Trim white spaces when parsing the fixed length record.
-
-
-
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 newFixedLengthRecordMapperinstance.- Parameters:
recordClass- the target domain object classfieldsLength- 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:
processRecordin interfaceorg.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
-
-