Class ValidatedConversion
- java.lang.Object
-
- com.univocity.parsers.conversions.ValidatedConversion
-
- All Implemented Interfaces:
Conversion<java.lang.Object,java.lang.Object>
public class ValidatedConversion extends java.lang.Object implements Conversion<java.lang.Object,java.lang.Object>
Performs one or more validations against the values of a given record.
-
-
Constructor Summary
Constructors Constructor Description ValidatedConversion()ValidatedConversion(boolean nullable, boolean allowBlanks)ValidatedConversion(boolean nullable, boolean allowBlanks, java.lang.String[] oneOf, java.lang.String[] noneOf, java.lang.String regexToMatch)ValidatedConversion(boolean nullable, boolean allowBlanks, java.lang.String[] oneOf, java.lang.String[] noneOf, java.lang.String regexToMatch, java.lang.Class[] validators)ValidatedConversion(java.lang.String regexToMatch)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute(java.lang.Object input)Converts a value of type I to a value of type O.java.lang.Objectrevert(java.lang.Object input)Converts a value of type O to a value of type I.protected voidvalidate(java.lang.Object value)
-
-
-
Constructor Detail
-
ValidatedConversion
public ValidatedConversion()
-
ValidatedConversion
public ValidatedConversion(java.lang.String regexToMatch)
-
ValidatedConversion
public ValidatedConversion(boolean nullable, boolean allowBlanks)
-
ValidatedConversion
public ValidatedConversion(boolean nullable, boolean allowBlanks, java.lang.String[] oneOf, java.lang.String[] noneOf, java.lang.String regexToMatch)
-
ValidatedConversion
public ValidatedConversion(boolean nullable, boolean allowBlanks, java.lang.String[] oneOf, java.lang.String[] noneOf, java.lang.String regexToMatch, java.lang.Class[] validators)
-
-
Method Detail
-
execute
public java.lang.Object execute(java.lang.Object input)
Description copied from interface:ConversionConverts a value of type I to a value of type O. When used in conjunction with theConvertannotation, this method will perform the conversion from a parsed inputString(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- Specified by:
executein interfaceConversion<java.lang.Object,java.lang.Object>- Parameters:
input- the input of type I to be converted to an object of type O- Returns:
- the conversion result.
-
revert
public java.lang.Object revert(java.lang.Object input)
Description copied from interface:ConversionConverts a value of type O to a value of type I. When used in conjunction with theConvertannotation, this method will convert the value of the annotated field so it can be written to the output (usually aString). Note that conversions can be chained so you need to make sure the type of any previous conversion is compatible with O- Specified by:
revertin interfaceConversion<java.lang.Object,java.lang.Object>- Parameters:
input- the input of type O to be converted to an object of type I- Returns:
- the conversion result.
-
validate
protected void validate(java.lang.Object value)
-
-