Package com.opencsv.bean.concurrent
Class ProcessCsvLine<T>
- java.lang.Object
-
- com.opencsv.bean.concurrent.ProcessCsvLine<T>
-
- Type Parameters:
T- The type of the bean being created
- All Implemented Interfaces:
java.lang.Runnable
public class ProcessCsvLine<T> extends java.lang.Object implements java.lang.RunnableA class that encapsulates the job of creating a bean from a line of CSV input and making it possible to run those jobs in parallel.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description private CsvExceptionHandlerexceptionHandlerprivate java.util.SortedSet<java.lang.Long>expectedRecordsprivate CsvToBeanFilterfilterprivate java.lang.String[]lineprivate longlineNumberprivate MappingStrategy<? extends T>mapperprivate java.util.concurrent.BlockingQueue<OrderedObject<T>>resultantBeanQueueprivate java.util.concurrent.BlockingQueue<OrderedObject<CsvException>>thrownExceptionsQueueprivate java.util.List<BeanVerifier<T>>verifiers
-
Constructor Summary
Constructors Constructor Description ProcessCsvLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, java.util.List<BeanVerifier<T>> verifiers, java.lang.String[] line, java.util.concurrent.BlockingQueue<OrderedObject<T>> resultantBeanQueue, java.util.concurrent.BlockingQueue<OrderedObject<CsvException>> thrownExceptionsQueue, java.util.SortedSet<java.lang.Long> expectedRecords, CsvExceptionHandler exceptionHandler)The only constructor for creating a bean out of a line of input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private TprocessLine()Creates a single object from a line from the CSV file.voidrun()
-
-
-
Field Detail
-
lineNumber
private final long lineNumber
-
mapper
private final MappingStrategy<? extends T> mapper
-
filter
private final CsvToBeanFilter filter
-
verifiers
private final java.util.List<BeanVerifier<T>> verifiers
-
line
private final java.lang.String[] line
-
resultantBeanQueue
private final java.util.concurrent.BlockingQueue<OrderedObject<T>> resultantBeanQueue
-
thrownExceptionsQueue
private final java.util.concurrent.BlockingQueue<OrderedObject<CsvException>> thrownExceptionsQueue
-
expectedRecords
private final java.util.SortedSet<java.lang.Long> expectedRecords
-
exceptionHandler
private final CsvExceptionHandler exceptionHandler
-
-
Constructor Detail
-
ProcessCsvLine
public ProcessCsvLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, java.util.List<BeanVerifier<T>> verifiers, java.lang.String[] line, java.util.concurrent.BlockingQueue<OrderedObject<T>> resultantBeanQueue, java.util.concurrent.BlockingQueue<OrderedObject<CsvException>> thrownExceptionsQueue, java.util.SortedSet<java.lang.Long> expectedRecords, CsvExceptionHandler exceptionHandler)The only constructor for creating a bean out of a line of input.- Parameters:
lineNumber- Which record in the input file is being processedmapper- The mapping strategy to be usedfilter- A filter to remove beans from the running, if necessary. May be null.verifiers- The list of verifiers to run on beans after creationline- The line of input to be transformed into a beanresultantBeanQueue- A queue in which to place the bean createdthrownExceptionsQueue- A queue in which to place a thrown exception, if one is thrownexpectedRecords- A list of outstanding record numbers so gaps in ordering due to filtered input or exceptions while converting can be detected.exceptionHandler- The handler for exceptions thrown during record processing
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
processLine
private T processLine() throws CsvBeanIntrospectionException, CsvBadConverterException, CsvFieldAssignmentException, CsvChainedException
Creates a single object from a line from the CSV file.- Returns:
- Object containing the values.
- Throws:
CsvBeanIntrospectionException- Thrown on error creating bean.CsvBadConverterException- If a custom converter cannot be initialized properlyCsvFieldAssignmentException- A more specific subclass of this exception is thrown for any problem decoding and assigning a field of the input to a bean fieldCsvChainedException- If multiple exceptions are thrown for the same input line
-
-