com.univocity.parsers.common
Interface ConversionProcessor

All Known Implementing Classes:
AbstractBatchedObjectColumnProcessor, AbstractBeanListProcessor, AbstractBeanProcessor, AbstractMasterDetailListProcessor, AbstractMasterDetailProcessor, AbstractMultiBeanListProcessor, AbstractMultiBeanProcessor, AbstractMultiBeanRowProcessor, AbstractObjectColumnProcessor, AbstractObjectListProcessor, AbstractObjectProcessor, BatchedObjectColumnProcessor, BeanConversionProcessor, BeanListProcessor, BeanProcessor, BeanWriterProcessor, DefaultConversionProcessor, MasterDetailListProcessor, MasterDetailProcessor, MultiBeanListProcessor, MultiBeanProcessor, MultiBeanRowProcessor, ObjectColumnProcessor, ObjectRowListProcessor, ObjectRowProcessor, ObjectRowWriterProcessor

public interface ConversionProcessor

A basic interface for classes that associate Conversion implementations with fields of a given input/output.


Method Summary
 void convertAll(Conversion... conversions)
          Applies a set of Conversion objects over all elements of a record
 FieldSet<String> convertFields(Conversion... conversions)
          Applies a set of Conversion objects over fields of a record by name.
 FieldSet<Integer> convertIndexes(Conversion... conversions)
          Applies a set of Conversion objects over indexes of a record.
 void convertType(Class<?> type, Conversion... conversions)
          Applies a sequence of conversions over values of a given type.
 

Method Detail

convertIndexes

FieldSet<Integer> convertIndexes(Conversion... conversions)
Applies a set of Conversion objects over indexes of a record.

The idiom to define which indexes should have these conversions applies is as follows:



 processor.convertIndexes(Conversions.trim(), Conversions.toUpperCase()).add(2, 5); // applies trim and uppercase conversions to fields in indexes 2 and 5
 

Parameters:
conversions - The sequence of conversions to be executed in a set of field indexes.
Returns:
A FieldSet for indexes.

convertAll

void convertAll(Conversion... conversions)
Applies a set of Conversion objects over all elements of a record

Parameters:
conversions - The sequence of conversions to be executed in all elements of a record

convertFields

FieldSet<String> convertFields(Conversion... conversions)
Applies a set of Conversion objects over fields of a record by name.

The idiom to define which fields should have these conversions applied is as follows:



 processor.convertFields(Conversions.trim(), Conversions.toUpperCase()).add("name", "position"); // applies trim and uppercase conversions to fields with headers "name" and "position"
 

Parameters:
conversions - The sequence of conversions to be executed in a set of field indexes.
Returns:
A FieldSet for field names.

convertType

void convertType(Class<?> type,
                 Conversion... conversions)
Applies a sequence of conversions over values of a given type. Used for writing.

Parameters:
type - the type over which a sequence of conversions should be applied
conversions - the sequence of conversions to apply over values of the given type.


Copyright © 2017 uniVocity Software Pty Ltd. All rights reserved.