T - the target domain object typepublic class DelimitedRecordMapper<T> extends Object implements RecordMapper<T>
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DELIMITER
The default delimiter.
|
static String |
DEFAULT_QUALIFIER
The default data qualifier.
|
static boolean |
DEFAULT_WHITESPACE_TRIMMING
Default whitespace trimming value.
|
| Constructor and Description |
|---|
DelimitedRecordMapper(Class<? extends T> recordClass)
Constructs a default DelimitedRecordMapper instance.
|
DelimitedRecordMapper(Class<? extends T> recordClass,
Integer[] fieldsPositions)
Constructs a DelimitedRecordMapper instance.
|
DelimitedRecordMapper(Class<? extends T> recordClass,
Integer[] fieldsPositions,
String[] fieldNames)
Constructs a DelimitedRecordMapper instance.
|
DelimitedRecordMapper(Class<? extends T> recordClass,
Integer[] fieldsPositions,
String[] fieldNames,
int recordExpectedLength)
Constructs a DelimitedRecordMapper instance.
|
DelimitedRecordMapper(Class<? extends T> recordClass,
String[] fieldNames)
Constructs a DelimitedRecordMapper instance.
|
DelimitedRecordMapper(Class<? extends T> recordClass,
String[] fieldNames,
int recordExpectedLength)
Constructs a DelimitedRecordMapper instance.
|
| Modifier and Type | Method and Description |
|---|---|
T |
mapRecord(Record record) |
void |
registerTypeConverter(TypeConverter typeConverter)
Register a custom type converter.
|
void |
setDelimiter(String delimiter)
Set the delimiter to use.
|
void |
setQualifier(String qualifier)
Set the data qualifier to use.
|
void |
setTrimWhitespaces(boolean trimWhitespaces)
Trim white spaces when parsing the DSV record.
|
public static final String DEFAULT_DELIMITER
public static final String DEFAULT_QUALIFIER
public static final boolean DEFAULT_WHITESPACE_TRIMMING
public DelimitedRecordMapper(Class<? extends T> recordClass)
recordClass - the target domain object classpublic DelimitedRecordMapper(Class<? extends T> recordClass, String[] fieldNames)
recordClass - the target domain object classfieldNames - a String array containing target type field names in the same order as in the delimited flat file.public DelimitedRecordMapper(Class<? extends T> recordClass, String[] fieldNames, int recordExpectedLength)
recordClass - the target domain object classfieldNames - a String array containing target type field names in the same order as in the delimited flat file.recordExpectedLength - record expected lengthpublic DelimitedRecordMapper(Class<? extends T> recordClass, Integer[] fieldsPositions)
recordClass - the target domain object classfieldsPositions - array of indexes of fields to retainpublic DelimitedRecordMapper(Class<? extends T> recordClass, Integer[] fieldsPositions, String[] fieldNames)
recordClass - the target domain object classfieldsPositions - array of indexes of fields to retainfieldNames - a String array representing fields name in the same order in the DSV flat file.public DelimitedRecordMapper(Class<? extends T> recordClass, Integer[] fieldsPositions, String[] fieldNames, int recordExpectedLength)
recordClass - the target domain object classfieldsPositions - array of indexes of fields to retainfieldNames - a String array representing fields name in the same order in the DSV flat file.recordExpectedLength - record expected lengthpublic T mapRecord(Record record) throws Exception
mapRecord in interface RecordMapper<T>Exceptionpublic void setDelimiter(String delimiter)
delimiter - the delimiter to usepublic void setTrimWhitespaces(boolean trimWhitespaces)
trimWhitespaces - true if whitespaces should be trimmedpublic void setQualifier(String qualifier)
qualifier - the data qualifier to use.public void registerTypeConverter(TypeConverter typeConverter)
typeConverter - the type converter to userCopyright © 2015. All Rights Reserved.