Package 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
Modifier and TypeMethodDescriptionvoidconvertAll(Conversion... conversions) Applies a set ofConversionobjects over all elements of a recordconvertFields(Conversion... conversions) Applies a set ofConversionobjects over fields of a record by name.convertIndexes(Conversion... conversions) Applies a set ofConversionobjects over indexes of a record.voidconvertType(Class<?> type, Conversion... conversions) Applies a sequence of conversions over values of a given type.
-
Method Details
-
convertIndexes
Applies a set ofConversionobjects 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
FieldSetfor indexes.
-
convertAll
Applies a set ofConversionobjects over all elements of a record- Parameters:
conversions- The sequence of conversions to be executed in all elements of a record
-
convertFields
Applies a set ofConversionobjects 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
FieldSetfor field names.
-
convertType
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 appliedconversions- the sequence of conversions to apply over values of the given type.
-