|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
R - the type of Record that this result stores.C - the type of Context used when the results where parsed.public interface Result<R extends com.univocity.parsers.common.record.Record,C extends com.univocity.parsers.common.Context>
An interface used to store the result of parsing some input with a parser implementing EntityParserInterface.
The fields that are captured and the order that they appear in each row depend on how they were configured using
EntitySettings before parsing.
EntityParserInterface,
EntitySettings,
Record| Method Summary | ||
|---|---|---|
void |
close()
Closes the row processing so no more rows will be added to the Result |
|
|
getBeans(Class<T> beanType)
Using the beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. |
|
|
getBeans(Class<T> beanType,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
Using the beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. |
|
C |
getContext()
|
|
String |
getEntityName()
Get the name of the entity that this result belongs to. |
|
String[] |
getHeaders()
Get an array of the headers of each field in the order that they were created and match the order that they appear in the methods that return a String[] for each row. |
|
Results<? extends Result<R,C>> |
getLinkedEntityData(int rowIndex)
Gets all of the Result associated with the specific rowIndex
in a Results list. |
|
Result<R,C> |
getLinkedFieldData(int rowIndex)
Gets then result with data for additional fields linked to the record at rowIndex. |
|
com.univocity.parsers.common.record.RecordMetaData |
getRecordMetaData()
|
|
List<R> |
getRecords()
Get a List of Record where each record represents a row in the results. |
|
List<String[]> |
getRows()
Get a List of String[] where each array is a row of results. |
|
boolean |
isComplete()
Whether or not all input has been parsed and no more row entries are to be added. |
|
|
iterateBeans(Class<T> beanType)
Using the beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. |
|
|
iterateBeans(Class<T> beanType,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
Using the beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. |
|
Iterable<R> |
iterateRecords()
Get an iterable of records that iterates over each row. |
|
Iterable<String[]> |
iterateRows()
Get an iterable of String[] that iterates over each row. |
|
Result<R,C> |
join(Result<R,C> result,
String... fieldNames)
Joins rows of a given result with the rows of the current one. |
|
void |
link(Result<R,C> result,
String... fieldNames)
Links rows of a given result with the rows of the current one. |
|
void |
process(com.univocity.parsers.common.processor.core.Processor<C> processor)
Uses the provided Processor to process each row of the result using a
default NoopProcessorErrorHandler to not handle any errors and simply rethrow them. |
|
void |
process(com.univocity.parsers.common.processor.core.Processor<C> processor,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
Uses the provided Processor to process each row of the result using the ProcessorErrorHandler to
handle any errors that occur. |
|
void |
waitForCompletion()
Pauses the processing of rows until all rows are captured and the queue is closed. |
|
| Method Detail |
|---|
String getEntityName()
C getContext()
com.univocity.parsers.common.record.RecordMetaData getRecordMetaData()
String[] getHeaders()
String[] for each row. e.g. getRows()
and iterateRows().
List<String[]> getRows()
List of String[] where each array is a row of results. The order of fields
in each row matches the order they were added to the EntityList and the order they appear
in getHeaders().
List of String[] for each row of the result.Iterable<String[]> iterateRows()
String[] that iterates over each row.
Iterable over each row.List<R> getRecords()
List of Record where each record represents a row in the results.
Each record contains the String captured for each field and also many convenience methods
for further data manipulation.
Iterable<R> iterateRecords()
Iterable over each rowvoid process(com.univocity.parsers.common.processor.core.Processor<C> processor)
Processor to process each row of the result using a
default NoopProcessorErrorHandler to not handle any errors and simply rethrow them.
processor - the Processor used to process each row of the result.
void process(com.univocity.parsers.common.processor.core.Processor<C> processor,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
Processor to process each row of the result using the ProcessorErrorHandler to
handle any errors that occur.
processor - the Processor used to process each row of the result.errorHandler - the ProcessorErrorHandler used to handle any error in a specific way
that occurs during processing.<T> List<T> getBeans(Class<T> beanType)
beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. Each row of this result, if successfully parsed, will be returned as an object
in a List of the specified type <T>. A null value for a field linked to a property of the bean
encountered during parsing results in the default value for primitives and a null value for objects being set.
The default NoopProcessorErrorHandler will be used as a ProcessorErrorHandler to not handle any
errors.
T - the type of the bean that is returned.beanType - the type of the bean that is created using the fields of this Result.
List that contains <T> for each bean successfully parsed from a row.
<T> List<T> getBeans(Class<T> beanType,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType. Each row of this result, if successfully parsed, will be returned as an object
in a List of the specified type <T>. A null value for a field linked to a property of the bean
encountered during parsing results in the default value for primitives and a null value for objects being set.
Any errors during parsing will be handled by the errorHandler.
T - the type of the bean that is returned.beanType - the type of the bean that is created using the fields of this Result.errorHandler - the ProcessorErrorHandler to handle any errors that occur during the processing
of beans.
List that contains <T> for each bean successfully parsed from a row.<T> com.univocity.parsers.common.IterableResult<T,C> iterateBeans(Class<T> beanType)
beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType.
Returns an IterableResult of beanType which is just like an Iterator
except it has the added Context for the parsing session.
A default NoopProcessorErrorHandler will be used as a ProcessorErrorHandler to not handle any
errors.
T - the type of bean to iterate over.beanType - the Class of the bean to create using fields of this Result.
IterableResult iterating over beans of the type beanType.
<T> com.univocity.parsers.common.IterableResult<T,C> iterateBeans(Class<T> beanType,
com.univocity.parsers.common.ProcessorErrorHandler<C> errorHandler)
beanType that has to contain one or more annotations from
com.univocity.parsers.annotations, the fields of this result are parsed into the matching fields
of the beanType.
Returns an IterableResult of beanType which is just like an Iterator
except it has the added Context for the parsing session.
Any errors during parsing will be handled by the errorHandler.
T - the type of bean to iterate over.beanType - the Class of the bean to create using fields of this Result.errorHandler - the ProcessorErrorHandler to handle any errors during the parsing of the bean.
IterableResult iterating over beans of the type beanType.boolean isComplete()
true then no more rows will be added.
void waitForCompletion()
throws InterruptedException
InterruptedException - if the thread is interrupted
Result<R,C> join(Result<R,C> result,
String... fieldNames)
Result instances.
result - the input result whose rows will be associated with the current.fieldNames - fields common to the given result and the current, whose values will be used to identify which
rows should be associated. If none provided the fields that are common to current and given
results will be used.
Result with the associated data.
void link(Result<R,C> result,
String... fieldNames)
Result instances.
The linked data is then accessible using getLinkedEntityData(int)
result - the other Result whose rows will be added to this Result's linked entity data.fieldNames - the common field names used to determine which fields to link. If none provided then all
fields that are common will be used.Result<R,C> getLinkedFieldData(int rowIndex)
rowIndex.
rowIndex - which row to get the linked field data from
rowIndexResults<? extends Result<R,C>> getLinkedEntityData(int rowIndex)
Result associated with the specific rowIndex
in a Results list.
rowIndex - which row to get the linked entity data from
rowIndexvoid close()
Result
close in interface Closeable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||