Package org.fastnate.data.properties
Class FormatConverter<T>
java.lang.Object
org.fastnate.data.properties.FormatConverter<T>
- Type Parameters:
T- the type of the returned value
- All Implemented Interfaces:
PropertyConverter<T>
- Direct Known Subclasses:
DateConverter
Converts a string from an import file to a Java object using a list of
Formats.
If the value is a number, the appropriate type conversion is applied.- Author:
- Tobias Liefke
-
Constructor Summary
ConstructorsConstructorDescriptionFormatConverter(Format... formats) Creates a new instance of aFormatConverter. -
Method Summary
-
Constructor Details
-
FormatConverter
Creates a new instance of aFormatConverter.- Parameters:
formats- the list of formats to try for conversion, the first that throws noParseExceptionis used
-
-
Method Details
-
convert
Description copied from interface:PropertyConverterConverts a value from import file to Java.- Specified by:
convertin interfacePropertyConverter<T>- Parameters:
targetType- the type of the target propertyvalue- the value in the import file- Returns:
- the value in Java
-
getFormats
All formats to test. The first that throws noParseExceptionis used for conversion.
-