Class CsvMapperFactory

java.lang.Object
org.simpleflatmapper.map.mapper.AbstractMapperFactory<K,MF,S>
org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory<CsvColumnKey,CsvMapperFactory,CsvRow>
org.simpleflatmapper.csv.CsvMapperFactory

public final class CsvMapperFactory extends org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory<CsvColumnKey,CsvMapperFactory,CsvRow>
CsvMapperFactory is not Thread-Safe but the mappers are. It is strongly advised to instantiate one jdbcMapper per class for the life of your application.

You can instantiate dynamic jdbcMapper which will use the name line of the csv file to figure out the list of the columns or a static one using a builder.

// create a dynamic jdbcMapper targeting MyClass
CsvMapperFactory
    .newInstance()
    .newMapper(MyClass.class);

// create a static jdbcMapper targeting MyClass
CsvMapperFactory
    .newInstance()
    .newBuilder(MyClass.class)
    .addMapping("id")
    .addMapping("field1")
    .addMapping("field2")
    .mapper();

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory

    org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory.DiscriminatorNamedGetter<S,T>, org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory.DiscriminatorNamedGetterFactory<S>

    Nested classes/interfaces inherited from class org.simpleflatmapper.map.mapper.AbstractMapperFactory

    org.simpleflatmapper.map.mapper.AbstractMapperFactory.DiscriminatorBuilder<S,K extends org.simpleflatmapper.map.FieldKey<K>,T>, org.simpleflatmapper.map.mapper.AbstractMapperFactory.DiscriminatorConditionBuilder<S,K extends org.simpleflatmapper.map.FieldKey<K>,KT,T>, org.simpleflatmapper.map.mapper.AbstractMapperFactory.DiscriminatorDSL<K extends org.simpleflatmapper.map.FieldKey<K>,MF extends org.simpleflatmapper.map.mapper.AbstractMapperFactory<K,MF,S>,S,T>, org.simpleflatmapper.map.mapper.AbstractMapperFactory.DiscriminatorOnColumnDSL<K extends org.simpleflatmapper.map.FieldKey<K>,MF extends org.simpleflatmapper.map.mapper.AbstractMapperFactory<K,MF,S>,S,T,KT>
  • Field Summary

    Fields inherited from class org.simpleflatmapper.map.mapper.AbstractMapperFactory

    discriminators, getterFactory
  • Method Summary

    Modifier and Type
    Method
    Description
    addCustomValueReader(String key, CellValueReader<?> cellValueReader)
     
    addCustomValueReader(String key, org.simpleflatmapper.lightningcsv.StringReader<?> stringReader)
     
     
    defaultDateFormat(String defaultDateFormat)
     
    org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey>
    enrichColumnDefinitions(org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey> columnDefinitions)
     
    newBuilder(Class<T> target)
    Will create a newInstance of ResultSetMapperBuilder
    newBuilder(Type target)
     
    newBuilder(org.simpleflatmapper.reflect.meta.ClassMeta<T> classMeta)
     
    newBuilder(org.simpleflatmapper.util.TypeReference<T> target)
     
    <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>>
     
    <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>>
     
    <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>>
    newErrorCollectingMapper(org.simpleflatmapper.util.TypeReference<T> target)
     
    instantiate a new JdbcMapperFactory
     
    newInstance(org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey> columnDefinitionProvider)
     
    <T> CsvMapper<T>
    newMapper(Class<T> target)
     
    <T> CsvMapper<T>
    newMapper(Type target)
     
    <T> CsvMapper<T>
    newMapper(org.simpleflatmapper.reflect.meta.ClassMeta<T> classMeta)
     
    <T> CsvMapper<T>
    newMapper(org.simpleflatmapper.util.TypeReference<T> target)
     

    Methods inherited from class org.simpleflatmapper.map.mapper.AbstractColumnNameDiscriminatorMapperFactory

    discriminator, discriminator, discriminator, discriminator

    Methods inherited from class org.simpleflatmapper.map.mapper.AbstractMapperFactory

    addAlias, addAliases, addAliasForType, addColumnDefinition, addColumnDefinition, addColumnProperty, addColumnProperty, addColumnProperty, addColumnPropertyForType, addColumnPropertyForType, addColumnPropertyForType, addColumnPropertyForType, addGetterFactory, addGetterForType, addGetterForType, addGetterForType, addGetterForType, addGetterForType, addKeys, asmMapperNbFieldsLimit, assumeInjectionModifiesValues, columnDefinitions, columnDefinitions, consumerErrorHandler, consumerErrorHandler, discriminator, discriminator, discriminator, discriminator, discriminator, discriminator, discriminator, discriminator, enableSpeculativeArrayIndexResolution, enableSpeculativePropertyLookupOnObject, failOnAsm, fieldMapperErrorHandler, getClassMeta, getClassMeta, getClassMeta, getClassMetaWithExtraInstantiator, getClassMetaWithExtraInstantiator, getClassMetaWithExtraInstantiator, getReflectionService, ignoreColumns, ignoreColumns, ignoreColumns, ignorePropertyNotFound, mapperBuilderErrorHandler, mapperConfig, mapperConfig, maxMethodSize, propertyNameMatcherFactory, propertyNameMatcherFactory, reflectionService, rowFilter, rowHandlerErrorHandler, unorderedJoin, useAsm

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newInstance

      public static CsvMapperFactory newInstance()
      instantiate a new JdbcMapperFactory
      Returns:
      a new JdbcMapperFactory
    • newInstance

      public static CsvMapperFactory newInstance(org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey> columnDefinitionProvider)
    • newInstance

      public static CsvMapperFactory newInstance(CsvMapperFactory cfg)
    • enrichColumnDefinitions

      public org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey> enrichColumnDefinitions(org.simpleflatmapper.map.mapper.AbstractColumnDefinitionProvider<CsvColumnKey> columnDefinitions)
      Overrides:
      enrichColumnDefinitions in class org.simpleflatmapper.map.mapper.AbstractMapperFactory<CsvColumnKey,CsvMapperFactory,CsvRow>
    • defaultDateFormat

      public CsvMapperFactory defaultDateFormat(String defaultDateFormat)
    • addCustomValueReader

      public CsvMapperFactory addCustomValueReader(String key, CellValueReader<?> cellValueReader)
    • addCustomValueReader

      public CsvMapperFactory addCustomValueReader(String key, org.simpleflatmapper.lightningcsv.StringReader<?> stringReader)
    • newMapper

      public <T> CsvMapper<T> newMapper(Class<T> target) throws org.simpleflatmapper.map.MapperBuildingException
      Type Parameters:
      T - the targeted type
      Parameters:
      target - the targeted class for the jdbcMapper
      Returns:
      a jdbc jdbcMapper that will map to the targeted class.
      Throws:
      org.simpleflatmapper.map.MapperBuildingException - if an error occurs building the jdbcMapper
    • newMapper

      public <T> CsvMapper<T> newMapper(org.simpleflatmapper.util.TypeReference<T> target) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newMapper

      public <T> CsvMapper<T> newMapper(Type target) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newMapper

      public <T> CsvMapper<T> newMapper(org.simpleflatmapper.reflect.meta.ClassMeta<T> classMeta) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newErrorCollectingMapper

      public <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>> newErrorCollectingMapper(Class<T> target) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newErrorCollectingMapper

      public <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>> newErrorCollectingMapper(org.simpleflatmapper.util.TypeReference<T> target) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newErrorCollectingMapper

      public <T> CsvMapper<org.simpleflatmapper.map.Result<T,CsvColumnKey>> newErrorCollectingMapper(Type target) throws org.simpleflatmapper.map.MapperBuildingException
      Throws:
      org.simpleflatmapper.map.MapperBuildingException
    • newBuilder

      public <T> CsvMapperBuilder<T> newBuilder(Class<T> target)
      Will create a newInstance of ResultSetMapperBuilder
      Type Parameters:
      T - the targeted type
      Parameters:
      target - the target class of the jdbcMapper
      Returns:
      a builder ready to instantiate a jdbcMapper or to be customized
      Throws:
      org.simpleflatmapper.map.MapperBuildingException - if an error occurs building the jdbcMapper
    • newBuilder

      public <T> CsvMapperBuilder<T> newBuilder(org.simpleflatmapper.util.TypeReference<T> target)
    • newBuilder

      public <T> CsvMapperBuilder<T> newBuilder(Type target)
    • newBuilder

      public <T> CsvMapperBuilder<T> newBuilder(org.simpleflatmapper.reflect.meta.ClassMeta<T> classMeta)
    • cellValueReaderFactory

      public CsvMapperFactory cellValueReaderFactory(CellValueReaderFactory cellValueReaderFactory)