public class FieldConversionMapping extends Object implements Cloneable
Conversion
objectsModifier and Type | Field and Description |
---|---|
int[] |
validatedIndexes |
Constructor and Description |
---|
FieldConversionMapping() |
Modifier and Type | Method and Description |
---|---|
Object |
applyConversions(int index,
String stringValue,
boolean[] convertedFlags)
Applies a sequence of conversions associated with a String value parsed from a given index.
|
void |
applyConversionsOnAllFields(Conversion<String,?>... conversions)
Applies a sequence of conversions on all fields.
|
FieldSet<Enum> |
applyConversionsOnFieldEnums(Conversion<String,?>... conversions)
Applies a sequence of conversions on a selection of enumerations that represent fields
|
FieldSet<Integer> |
applyConversionsOnFieldIndexes(Conversion<String,?>... conversions)
Applies a sequence of conversions on a selection of field indexes
|
FieldSet<String> |
applyConversionsOnFieldNames(Conversion<String,?>... conversions)
Applies a sequence of conversions on a selection of field name
|
FieldConversionMapping |
clone() |
void |
executeValidations(int index,
Object value)
Applies any validations associated with a field at a given index in a record
|
Conversion[] |
getConversions(int index,
Class<?> expectedType)
Returns the sequence of conversions to be applied at a given column index
|
void |
prepareExecution(boolean writing,
String[] values)
Prepares the conversions registered in this object to be executed against a given sequence of fields
|
Object |
reverseConversions(boolean executeInReverseOrder,
int index,
Object value,
boolean[] convertedFlags)
Applies a sequence of conversions associated with an Object value at a given index in a record.
|
public void prepareExecution(boolean writing, String[] values)
writing
- flag indicating whether a writing process is being initialized.values
- The field sequence that identifies how records will be organized.
This is generally the sequence of headers in a record, but it might be just the first parsed row from a given input (as field selection by index is allowed).
public void applyConversionsOnAllFields(Conversion<String,?>... conversions)
conversions
- the sequence of conversions to be appliedpublic FieldSet<Integer> applyConversionsOnFieldIndexes(Conversion<String,?>... conversions)
conversions
- the sequence of conversions to be appliedpublic FieldSet<String> applyConversionsOnFieldNames(Conversion<String,?>... conversions)
conversions
- the sequence of conversions to be appliedpublic FieldSet<Enum> applyConversionsOnFieldEnums(Conversion<String,?>... conversions)
conversions
- the sequence of conversions to be appliedpublic void executeValidations(int index, Object value)
index
- The index of parsed value in a recordvalue
- The value of the record at the given indexpublic Object reverseConversions(boolean executeInReverseOrder, int index, Object value, boolean[] convertedFlags)
executeInReverseOrder
- flag to indicate whether or not the conversion sequence must be executed in reverse orderindex
- The index of parsed value in a recordvalue
- The value in a recordconvertedFlags
- an array of flags that indicate whether a conversion occurred. Used to determine whether
or not a default conversion by type (specified with ConversionProcessor.convertType(Class, Conversion[])
) should be applied.public Object applyConversions(int index, String stringValue, boolean[] convertedFlags)
index
- The index of parsed value in a recordstringValue
- The parsed value in a recordconvertedFlags
- an array of flags that indicate whether a conversion occurred. Used to determine whether
or not a default conversion by type (specified with ConversionProcessor.convertType(Class, Conversion[])
) should be applied.public Conversion[] getConversions(int index, Class<?> expectedType)
index
- the index of the column where the conversions should be executedexpectedType
- the type resulting from the conversion sequence.public FieldConversionMapping clone()
Copyright © 2022 Univocity Software Pty Ltd. All rights reserved.