Class GenericConverter
java.lang.Object
com.norconex.commons.lang.convert.GenericConverter
- All Implemented Interfaces:
Converter
Converts strings to objects and objects to strings. Supported object types are guaranteed to be convertible both ways if converted by this class.
Can only be initialized at construction time or the default instance can be obtained statically.
Converted string values are NOT locale-specific. This class favors consistency over format and string values are not always appropriate for human-consumption.
Default instance has converters for the following types:
BigDecimalBigIntegerBoolean/booleanByte/byteCharacter/charCharsetContentTypeDateDimensionDouble/doubleDurationEnumFileFloat/floatInstantInteger/intLocalDateTimeLocaleLong/longPathPatternShort/shortURLZonedDateTimeZoneId
By default ConverterException is thrown when conversion fails.
- Since:
- 3.0.0 (renamed from 2.x "Converter")
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic <T> Tstatic <T> Tstatic <T> List<T> static GenericConvertergetConverter(Class<?> type) booleanisConvertible(Class<?> type) <T> T<T> T<T> List<T>
-
Constructor Details
-
GenericConverter
-
-
Method Details
-
defaultInstance
-
getConverters
-
convert
-
convert
-
convert
-
convert
-
convert
-
convert
-
toType
-
toType
-
toType
-
toString
-
toString
-
toString
-
isConvertible
-
getConverter
-