public final class CsvMapperFactory extends Object
You can instantiate dynamic mapper which will use the first line of the csv file to figure out the list of the columns or a static one using a builder.
// create a dynamic mapper targeting MyClass
CsvMapperFactory
.newInstance()
.newMapper(MyClass.class);
// create a static mapper targeting MyClass
CsvMapperFactory
.newInstance()
.newBuilder(MyClass.class)
.addMapping("id")
.addMapping("field1")
.addMapping("field2")
.mapper();
| Constructor and Description |
|---|
CsvMapperFactory() |
public static CsvMapperFactory newInstance()
public CsvMapperFactory fieldMapperErrorHandler(FieldMapperErrorHandler<CsvColumnKey> fieldMapperErrorHandler)
fieldMapperErrorHandler - the FieldMapperErrorHandlerpublic CsvMapperFactory mapperBuilderErrorHandler(MapperBuilderErrorHandler mapperBuilderErrorHandler)
mapperBuilderErrorHandler - the MapperBuilderErrorHandlerpublic CsvMapperFactory rowHandlerErrorHandler(RowHandlerErrorHandler rowHandlerErrorHandler)
rowHandlerErrorHandler - the RowHandlerErrorHandlerpublic CsvMapperFactory useAsm(boolean useAsm)
useAsm - false if you want to disable asm usage.public CsvMapperFactory failOnAsm(boolean failOnAsm)
failOnAsm - true if don't want to recover from an asm generation failure of the mapperpublic CsvMapperFactory asmMapperNbFieldsLimit(int asmMapperNbFieldsLimit)
the default value is calculated from the benchmark results, currently 240.
asmMapperNbFieldsLimit - the limit after which it does not use asm for the mapper.public CsvMapperFactory maxMethodSize(int maxMethodSize)
maxMethodSize - the max method size, needs be a power of 2.public CsvMapperFactory disableAsm(boolean disableAsm)
disableAsm - true if you want to disable asm.public CsvMapperFactory defaultDateFormat(String defaultDateFormat)
public CsvMapperFactory cellValueReaderFactory(CellValueReaderFactory cellValueReaderFactory)
public <T> CsvMapper<T> newMapper(Class<T> target) throws MapperBuildingException
T - the targeted typetarget - the targeted class for the mapperMapperBuildingException - if an error occurs building the mapperpublic <T> CsvMapper<T> newMapper(TypeReference<T> target) throws MapperBuildingException
MapperBuildingExceptionpublic <T> CsvMapper<T> newMapper(Type target) throws MapperBuildingException
MapperBuildingExceptionpublic <T> CsvMapperBuilder<T> newBuilder(Class<T> target)
T - the targeted typetarget - the target class of the mapperMapperBuildingException - if an error occurs building the mapperpublic <T> CsvMapperBuilder<T> newBuilder(TypeReference<T> target)
public <T> CsvMapperBuilder<T> newBuilder(Type target)
public CsvMapperFactory addAlias(String key, String value)
public CsvMapperFactory addCustomValueReader(String key, CellValueReader<?> cellValueReader)
public CsvMapperFactory propertyNameMatcherFactory(PropertyNameMatcherFactory propertyNameMatcherFactory)
public CsvMapperFactory addColumnDefinition(String key, CsvColumnDefinition columnDefinition)
public CsvMapperFactory addColumnDefinition(Predicate<? super CsvColumnKey> predicate, CsvColumnDefinition columnDefinition)
public CsvMapperFactory addKeys(String... columns)
Copyright © 2015. All rights reserved.