Class CsvMapperImpl<T>

java.lang.Object
org.simpleflatmapper.csv.impl.CsvMapperImpl<T>
All Implemented Interfaces:
CsvMapper<T>, org.simpleflatmapper.map.ContextualSourceMapper<CsvRow,T>, org.simpleflatmapper.map.EnumerableMapper<CsvRowSet,T,IOException>, org.simpleflatmapper.map.SetRowMapper<CsvRow,CsvRowSet,T,IOException>, org.simpleflatmapper.map.SourceMapper<CsvRow,T>

public class CsvMapperImpl<T> extends Object implements CsvMapper<T>
  • Constructor Summary

    Constructors
    Constructor
    Description
    CsvMapperImpl(org.simpleflatmapper.map.SetRowMapper<CsvRow,CsvRowSet,T,IOException> setRowMapper, CsvColumnKey[] keys)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.simpleflatmapper.util.Enumerable<T>
     
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(Reader reader, H handle)
    Will map each row of the content of reader to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(Reader reader, H handle, int skip)
    Will map each row of the content of reader, starting at rowStart, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(Reader reader, H handle, int skip, int limit)
    Will map each row of the content of reader, starting at rowStart and ending before rowEnd, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(CsvRowSet source, H handler)
     
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(org.simpleflatmapper.lightningcsv.CsvReader reader, H handle)
    Will map each row of the content of reader to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
    <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
    H
    forEach(org.simpleflatmapper.lightningcsv.CsvReader reader, H handle, int limit)
    Will map each row of the content of reader, starting at rowStart and ending before rowEnd, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
    iterator(Reader reader)
    Will return an iterator on the reader that will return a mapped object for each row.
    iterator(Reader reader, int skip)
    Will return an iterator on the reader that will return a mapped object for each row.
     
    iterator(org.simpleflatmapper.lightningcsv.CsvReader reader)
    Will return an iterator on the reader that will return a mapped object for each row.
    map(CsvRow source)
     
    map(CsvRow source, org.simpleflatmapper.map.MappingContext<? super CsvRow> context)
     
    stream(Reader reader)
    Will return a Stream of T
    stream(Reader reader, int skip)
    Will return a Stream of T.
    stream(CsvRowSet source)
     
    stream(org.simpleflatmapper.lightningcsv.CsvReader reader)
    Will return a Stream of T

    Methods inherited from class java.lang.Object

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

  • Method Details

    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(Reader reader, H handle) throws IOException, org.simpleflatmapper.map.MappingException
      Description copied from interface: CsvMapper
      Will map each row of the content of reader to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.

      The method will return the handler passed as an argument so you can easily chain the calls like
      List<T> list = jdbcMapper.forEach(reader, new ListHandler<T>()).getList();

      Specified by:
      forEach in interface CsvMapper<T>
      Type Parameters:
      H - the row handler type
      Parameters:
      reader - the reader
      handle - the callback newInstance
      Returns:
      the callback newInstance
      Throws:
      IOException - if an io error occurs
      org.simpleflatmapper.map.MappingException - if an mapping error occurs
    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(org.simpleflatmapper.lightningcsv.CsvReader reader, H handle) throws IOException, org.simpleflatmapper.map.MappingException
      Description copied from interface: CsvMapper
      Will map each row of the content of reader to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
      Specified by:
      forEach in interface CsvMapper<T>
      Type Parameters:
      H - the row handler type
      Parameters:
      reader - the reader
      handle - the callback newInstance
      Returns:
      the callback newInstance
      Throws:
      IOException - if an io error occurs
      org.simpleflatmapper.map.MappingException - if an mapping error occurs
    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(Reader reader, H handle, int skip) throws IOException, org.simpleflatmapper.map.MappingException
      Description copied from interface: CsvMapper
      Will map each row of the content of reader, starting at rowStart, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
      Specified by:
      forEach in interface CsvMapper<T>
      Type Parameters:
      H - the row handler type
      Parameters:
      reader - the reader
      handle - the callback newInstance
      skip - the number of row to skip
      Returns:
      the callback newInstance
      Throws:
      IOException - if an io error occurs
      org.simpleflatmapper.map.MappingException - if an mapping error occurs
    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(Reader reader, H handle, int skip, int limit) throws IOException, org.simpleflatmapper.map.MappingException
      Description copied from interface: CsvMapper
      Will map each row of the content of reader, starting at rowStart and ending before rowEnd, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
      Specified by:
      forEach in interface CsvMapper<T>
      Type Parameters:
      H - the row handler type
      Parameters:
      reader - the reader
      handle - the callback newInstance
      skip - the number of row to skip
      limit - the number of row to process
      Returns:
      the callback newInstance
      Throws:
      IOException - if an io error occurs
      org.simpleflatmapper.map.MappingException - if an mapping error occurs
    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(org.simpleflatmapper.lightningcsv.CsvReader reader, H handle, int limit) throws IOException, org.simpleflatmapper.map.MappingException
      Description copied from interface: CsvMapper
      Will map each row of the content of reader, starting at rowStart and ending before rowEnd, to an object of type T and will pass that object to the handle via the CheckedConsumer.handler(T t) call back.
      Specified by:
      forEach in interface CsvMapper<T>
      Type Parameters:
      H - the row handler type
      Parameters:
      reader - the reader
      handle - the callback newInstance
      limit - the number of row to process
      Returns:
      the callback newInstance
      Throws:
      IOException - if an io error occurs
      org.simpleflatmapper.map.MappingException - if an mapping error occurs
    • iterator

      public Iterator<T> iterator(Reader reader) throws IOException
      Description copied from interface: CsvMapper
      Will return an iterator on the reader that will return a mapped object for each row.
      Specified by:
      iterator in interface CsvMapper<T>
      Parameters:
      reader - the reader
      Returns:
      an iterator on the file
      Throws:
      IOException - if an io error occurs
    • iterator

      public Iterator<T> iterator(org.simpleflatmapper.lightningcsv.CsvReader reader) throws IOException
      Description copied from interface: CsvMapper
      Will return an iterator on the reader that will return a mapped object for each row.
      Specified by:
      iterator in interface CsvMapper<T>
      Parameters:
      reader - the reader
      Returns:
      an iterator on the file
      Throws:
      IOException - if an io error occurs
    • iterator

      public Iterator<T> iterator(Reader reader, int skip) throws IOException
      Description copied from interface: CsvMapper
      Will return an iterator on the reader that will return a mapped object for each row.
      Specified by:
      iterator in interface CsvMapper<T>
      Parameters:
      reader - the reader
      skip - the number of row to skip
      Returns:
      an iterator on the file
      Throws:
      IOException - if an io error occurs
    • stream

      public Stream<T> stream(Reader reader) throws IOException
      Description copied from interface: CsvMapper
      Will return a Stream of T
      Specified by:
      stream in interface CsvMapper<T>
      Parameters:
      reader - the reader
      Returns:
      stream of T
      Throws:
      IOException - if an io error occurs
    • stream

      public Stream<T> stream(org.simpleflatmapper.lightningcsv.CsvReader reader) throws IOException
      Description copied from interface: CsvMapper
      Will return a Stream of T
      Specified by:
      stream in interface CsvMapper<T>
      Parameters:
      reader - the reader
      Returns:
      stream of T
      Throws:
      IOException - if an io error occurs
    • stream

      public Stream<T> stream(Reader reader, int skip) throws IOException
      Description copied from interface: CsvMapper
      Will return a Stream of T.
      Specified by:
      stream in interface CsvMapper<T>
      Parameters:
      reader - the reader
      skip - the number of row to skip
      Returns:
      stream of T
      Throws:
      IOException - if an io error occurs
    • forEach

      public <H extends org.simpleflatmapper.util.CheckedConsumer<? super T>> H forEach(CsvRowSet source, H handler) throws IOException, org.simpleflatmapper.map.MappingException
      Specified by:
      forEach in interface org.simpleflatmapper.map.EnumerableMapper<CsvRowSet,T,IOException>
      Throws:
      IOException
      org.simpleflatmapper.map.MappingException
    • iterator

      public Iterator<T> iterator(CsvRowSet source) throws IOException, org.simpleflatmapper.map.MappingException
      Specified by:
      iterator in interface org.simpleflatmapper.map.EnumerableMapper<CsvRowSet,T,IOException>
      Throws:
      IOException
      org.simpleflatmapper.map.MappingException
    • stream

      public Stream<T> stream(CsvRowSet source) throws IOException, org.simpleflatmapper.map.MappingException
      Specified by:
      stream in interface org.simpleflatmapper.map.EnumerableMapper<CsvRowSet,T,IOException>
      Throws:
      IOException
      org.simpleflatmapper.map.MappingException
    • enumerate

      public org.simpleflatmapper.util.Enumerable<T> enumerate(CsvRowSet source) throws IOException, org.simpleflatmapper.map.MappingException
      Specified by:
      enumerate in interface org.simpleflatmapper.map.EnumerableMapper<CsvRowSet,T,IOException>
      Throws:
      IOException
      org.simpleflatmapper.map.MappingException
    • map

      public T map(CsvRow source) throws org.simpleflatmapper.map.MappingException
      Specified by:
      map in interface org.simpleflatmapper.map.ContextualSourceMapper<CsvRow,T>
      Throws:
      org.simpleflatmapper.map.MappingException
    • map

      public T map(CsvRow source, org.simpleflatmapper.map.MappingContext<? super CsvRow> context) throws org.simpleflatmapper.map.MappingException
      Specified by:
      map in interface org.simpleflatmapper.map.SourceMapper<CsvRow,T>
      Throws:
      org.simpleflatmapper.map.MappingException