Package org.jeasy.batch.flatfile
Class DelimitedRecordMarshaller<P>
- java.lang.Object
-
- org.jeasy.batch.flatfile.DelimitedRecordMarshaller<P>
-
- Type Parameters:
P
- type of the record's payload
- All Implemented Interfaces:
org.jeasy.batch.core.marshaller.RecordMarshaller<P,java.lang.String>
,org.jeasy.batch.core.processor.RecordProcessor<P,java.lang.String>
public class DelimitedRecordMarshaller<P> extends java.lang.Object implements org.jeasy.batch.core.marshaller.RecordMarshaller<P,java.lang.String>
Marshals a POJO to CSV format. This marshaller does not support recursive marshalling.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DELIMITER
static java.lang.String
DEFAULT_QUALIFIER
-
Constructor Summary
Constructors Constructor Description DelimitedRecordMarshaller(java.lang.Class<P> type, java.lang.String... fields)
Create a newDelimitedRecordMarshaller
.DelimitedRecordMarshaller(org.jeasy.batch.core.field.FieldExtractor<P> fieldExtractor)
Create a newDelimitedRecordMarshaller
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jeasy.batch.core.record.StringRecord
processRecord(org.jeasy.batch.core.record.Record<P> record)
void
setDelimiter(java.lang.String delimiter)
Set the delimiter to use.void
setQualifier(java.lang.String qualifier)
Set the data qualifier to use.
-
-
-
Field Detail
-
DEFAULT_DELIMITER
public static final java.lang.String DEFAULT_DELIMITER
- See Also:
- Constant Field Values
-
DEFAULT_QUALIFIER
public static final java.lang.String DEFAULT_QUALIFIER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DelimitedRecordMarshaller
public DelimitedRecordMarshaller(java.lang.Class<P> type, java.lang.String... fields)
Create a newDelimitedRecordMarshaller
.- Parameters:
type
- of object to marshalfields
- to marshal in order
-
DelimitedRecordMarshaller
public DelimitedRecordMarshaller(org.jeasy.batch.core.field.FieldExtractor<P> fieldExtractor)
Create a newDelimitedRecordMarshaller
.- Parameters:
fieldExtractor
- to use to extract fields
-
-
Method Detail
-
processRecord
public org.jeasy.batch.core.record.StringRecord processRecord(org.jeasy.batch.core.record.Record<P> record) throws java.lang.Exception
- Specified by:
processRecord
in interfaceorg.jeasy.batch.core.processor.RecordProcessor<P,java.lang.String>
- Throws:
java.lang.Exception
-
setDelimiter
public void setDelimiter(java.lang.String delimiter)
Set the delimiter to use.- Parameters:
delimiter
- the delimiter to use
-
setQualifier
public void setQualifier(java.lang.String qualifier)
Set the data qualifier to use.- Parameters:
qualifier
- the data qualifier to use.
-
-