Top Description Fields Constructors Methods
com.univocity.parsers.conversions

public Class ValidatedConversion

extends Object
implements Conversion<Object, Object>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.conversions.Conversion
Imports
com.univocity.parsers.annotations.helpers.*, com.univocity.parsers.common.*, java.util.*, java.util.regex.*

Performs one or more validations against the values of a given record.

Field Summary

Modifier and TypeField and Description
private final boolean
private final Matcher
private final Set<String>
private final boolean
private final Set<String>
private final String
private final Validator<T>[]

Constructor Summary

AccessConstructor and Description
public
public
public
ValidatedConversion(boolean nullable, boolean allowBlanks)

public
ValidatedConversion(boolean nullable, boolean allowBlanks, String[] oneOf, String[] noneOf, String regexToMatch)

public
ValidatedConversion(boolean nullable, boolean allowBlanks, String[] oneOf, String[] noneOf, String regexToMatch, Class<T>[] validators)

Method Summary

Modifier and TypeMethod and Description
public Object
execute(Object
the input of type I to be converted to an object of type O
input
)

Implements com.univocity.parsers.conversions.Conversion.execute.

Converts a value of type I to a value of type O.
private Validator<T>[]
instantiateValidators(Class<T>[] validators)

public Object
revert(Object
the input of type O to be converted to an object of type I
input
)

Implements com.univocity.parsers.conversions.Conversion.revert.

Converts a value of type O to a value of type I.
protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allowBlanksback to summary
private final boolean allowBlanks
matcherback to summary
private final Matcher matcher
noneOfback to summary
private final Set<String> noneOf
nullableback to summary
private final boolean nullable
oneOfback to summary
private final Set<String> oneOf
regexToMatchback to summary
private final String regexToMatch
validatorsback to summary
private final Validator<T>[] validators

Constructor Detail

ValidatedConversionback to summary
public ValidatedConversion()
ValidatedConversionback to summary
public ValidatedConversion(String regexToMatch)
ValidatedConversionback to summary
public ValidatedConversion(boolean nullable, boolean allowBlanks)
ValidatedConversionback to summary
public ValidatedConversion(boolean nullable, boolean allowBlanks, String[] oneOf, String[] noneOf, String regexToMatch)
ValidatedConversionback to summary
public ValidatedConversion(boolean nullable, boolean allowBlanks, String[] oneOf, String[] noneOf, String regexToMatch, Class<T>[] validators)

Method Detail

executeback to summary
public Object execute(Object input)

Implements com.univocity.parsers.conversions.Conversion.execute.

Doc from com.univocity.parsers.conversions.Conversion.execute.

Converts a value of type I to a value of type O. When used in conjunction with the com.univocity.parsers.annotations.Convert annotation, this method will perform the conversion from a parsed input String (if no other conversion has been applied before) to a value of the desired type, and the result will be assigned to the annotated field. Note that conversions can be chained so you need to make sure the input type of any previous conversion is compatible with I

Parameters
input:Object

the input of type I to be converted to an object of type O

Returns:Object

the conversion result.

Annotations
@Override
instantiateValidatorsback to summary
private Validator<T>[] instantiateValidators(Class<T>[] validators)
revertback to summary
public Object revert(Object input)

Implements com.univocity.parsers.conversions.Conversion.revert.

Doc from com.univocity.parsers.conversions.Conversion.revert.

Converts a value of type O to a value of type I. When used in conjunction with the com.univocity.parsers.annotations.Convert annotation, this method will convert the value of the annotated field so it can be written to the output (usually a String). Note that conversions can be chained so you need to make sure the type of any previous conversion is compatible with O

Parameters
input:Object

the input of type O to be converted to an object of type I

Returns:Object

the conversion result.

Annotations
@Override
validateback to summary
protected void validate(Object value)