Module litebridge.converter
Class AbstractStringParsingConverter<T>
java.lang.Object
org.litebridgedb.convert.converter.AbstractStringParsingConverter<T>
- Type Parameters:
T- the target type
- All Implemented Interfaces:
Converter<T>,ConverterFunction<T>
- Direct Known Subclasses:
BooleanConverter,CharacterConverter,SqlDateConverter
An abstract base class for
Converter implementations that primarily convert values by parsing their string representation.
This class handles null values, identity conversions (where the input is already an instance of the target type),
and delegates the parsing of non-blank strings to convertString(String).
-
Constructor Details
-
AbstractStringParsingConverter
public AbstractStringParsingConverter()
-
-
Method Details
-
convert
Converts the given value to the target type.The conversion process follows these steps:
- If the value is
null, returnsnull. - If the value is already an instance of the target type, returns it as-is.
- Otherwise, converts the value to a string and, if not blank, calls
convertString(String).
- Specified by:
convertin interfaceConverterFunction<T>- Parameters:
value- the value to convert, may benull- Returns:
- the converted value, or
null
- If the value is
-
convertString
Parses a string value into the target type.- Parameters:
value- the string value to parse- Returns:
- the parsed value
-