Interface Conversion<I,O>
-
- Type Parameters:
I
- The input type to be converted to the output type OO
- The type of outputs produced by a conversion applied to the an input I. When used in conjunction with theConvert
annotation, O should be compatible with the type of the annotated field.
- All Known Implementing Classes:
BigDecimalConversion
,BigIntegerConversion
,BooleanConversion
,ByteConversion
,CalendarConversion
,CharacterConversion
,DateConversion
,DoubleConversion
,EnumConversion
,FloatConversion
,FormattedBigDecimalConversion
,FormattedDateConversion
,IntegerConversion
,LongConversion
,LowerCaseConversion
,NullConversion
,NullStringConversion
,NumericConversion
,ObjectConversion
,RegexConversion
,ShortConversion
,ToStringConversion
,TrimConversion
,UpperCaseConversion
,ValidatedConversion
public interface Conversion<I,O>
The interface that defines the conversion from one type of value to another, and vice versa. univocity-parsers provides a set of default conversions for usage withObjectRowProcessor
andObjectRowWriterProcessor
. Annotations in packagecom.univocity.parsers.annotations
are associated with different Conversion implementations incom.univocity.parsers.conversions
.- See Also:
ObjectRowProcessor
,ObjectRowWriterProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description O
execute(I input)
Converts a value of type I to a value of type O.I
revert(O input)
Converts a value of type O to a value of type I.
-
-
-
Method Detail
-
execute
O execute(I input)
Converts a value of type I to a value of type O. When used in conjunction with theConvert
annotation, 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- Parameters:
input
- the input of type I to be converted to an object of type O- Returns:
- the conversion result.
-
revert
I revert(O input)
Converts a value of type O to a value of type I. When used in conjunction with theConvert
annotation, 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- Parameters:
input
- the input of type O to be converted to an object of type I- Returns:
- the conversion result.
-
-