Top Description Fields Constructors Methods
com.opencsv.bean.concurrent

public Class ProcessCsvLine<T>

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Type Parameters
<T>
The type of the bean being created
Imports
com.opencsv.bean.BeanVerifier, .CsvToBeanFilter, .MappingStrategy, com.opencsv.bean.exceptionhandler.CsvExceptionHandler, com.opencsv.bean.util.OpencsvUtils, .OrderedObject, com.opencsv.exceptions.*, org.apache.commons.lang3.ArrayUtils, .ObjectUtils, java.util.*, java.util.concurrent.BlockingQueue

A 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.
Author
Andrew Rucker Jones
Since
4.0

Field Summary

Modifier and TypeField and Description
private final CsvExceptionHandler
private final SortedSet<Long>
private final CsvToBeanFilter
private final String[]
private final long
private final MappingStrategy<? extends T>
private final BlockingQueue<OrderedObject<T>>
private final BlockingQueue<OrderedObject<CsvException>>
private final List<BeanVerifier<T>>

Constructor Summary

AccessConstructor and Description
public
ProcessCsvLine(long
Which record in the input file is being processed
lineNumber
,
MappingStrategy<? extends T>
The mapping strategy to be used
mapper
,
CsvToBeanFilter
A filter to remove beans from the running, if necessary. May be null.
filter
,
List<BeanVerifier<T>>
The list of verifiers to run on beans after creation
verifiers
,
String[]
The line of input to be transformed into a bean
line
,
BlockingQueue<OrderedObject<T>>
A queue in which to place the bean created
resultantBeanQueue
,
BlockingQueue<OrderedObject<CsvException>>
A queue in which to place a thrown exception, if one is thrown
thrownExceptionsQueue
,
SortedSet<Long>
A list of outstanding record numbers so gaps in ordering due to filtered input or exceptions while converting can be detected.
expectedRecords
,
CsvExceptionHandler
The handler for exceptions thrown during record processing
exceptionHandler
)

The only constructor for creating a bean out of a line of input.

Method Summary

Modifier and TypeMethod and Description
private T

Returns:

Object containing the values.
processLine
()

Creates a single object from a line from the CSV file.

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exceptionHandlerback to summary
private final CsvExceptionHandler exceptionHandler
expectedRecordsback to summary
private final SortedSet<Long> expectedRecords
filterback to summary
private final CsvToBeanFilter filter
lineback to summary
private final String[] line
lineNumberback to summary
private final long lineNumber
mapperback to summary
private final MappingStrategy<? extends T> mapper
resultantBeanQueueback to summary
private final BlockingQueue<OrderedObject<T>> resultantBeanQueue
thrownExceptionsQueueback to summary
private final BlockingQueue<OrderedObject<CsvException>> thrownExceptionsQueue
verifiersback to summary
private final List<BeanVerifier<T>> verifiers

Constructor Detail

ProcessCsvLineback to summary
public ProcessCsvLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, List<BeanVerifier<T>> verifiers, String[] line, BlockingQueue<OrderedObject<T>> resultantBeanQueue, BlockingQueue<OrderedObject<CsvException>> thrownExceptionsQueue, SortedSet<Long> expectedRecords, CsvExceptionHandler exceptionHandler)

The only constructor for creating a bean out of a line of input.

Parameters
lineNumber:long

Which record in the input file is being processed

mapper:MappingStrategy<? extends T>

The mapping strategy to be used

filter:CsvToBeanFilter

A filter to remove beans from the running, if necessary. May be null.

verifiers:List<BeanVerifier<T>>

The list of verifiers to run on beans after creation

line:String[]

The line of input to be transformed into a bean

resultantBeanQueue:BlockingQueue<OrderedObject<T>>

A queue in which to place the bean created

thrownExceptionsQueue:BlockingQueue<OrderedObject<CsvException>>

A queue in which to place a thrown exception, if one is thrown

expectedRecords:SortedSet<Long>

A list of outstanding record numbers so gaps in ordering due to filtered input or exceptions while converting can be detected.

exceptionHandler:CsvExceptionHandler

The handler for exceptions thrown during record processing

Method Detail

processLineback to summary
private T processLine() throws CsvBeanIntrospectionException, CsvBadConverterException, CsvFieldAssignmentException, CsvChainedException

Creates a single object from a line from the CSV file.

Returns:T

Object containing the values.

Exceptions
CsvBeanIntrospectionException:
Thrown on error creating bean.
CsvBadConverterException:
If a custom converter cannot be initialized properly
CsvFieldAssignmentException:
A more specific subclass of this exception is thrown for any problem decoding and assigning a field of the input to a bean field
CsvChainedException:
If multiple exceptions are thrown for the same input line
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override