Class Converter
java.lang.Object
com.norconex.commons.lang.convert.Converter
- All Implemented Interfaces:
IConverter
Converts strings to objects and objects to strings. Supported object types are guaranteed to be convertibles 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:
Byte/byteShort/shortInteger/intFloat/floatLong/longDouble/doubleBigIntegerBigDecimalBoolean/booleanCharacter/charFilePathDateLocalDateTimeZonedDateTimeInstantLocaleEnumDimensionDurationContentTypeCharsetURL
By default ConverterException is thrown when conversion fails.
- Since:
- 2.0.0
- Author:
- Pascal Essiembre
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic <T> Tstatic <T> Tstatic <T> List<T>static ConvertergetConverter(Class<?> type) Map<Class<?>,IConverter> booleanisConvertible(Class<?> type) <T> T<T> T<T> List<T>
-
Constructor Details
-
Converter
-
-
Method Details
-
defaultInstance
-
getConverters
-
convert
-
convert
-
convert
-
convert
-
convert
-
convert
-
toType
-
toType
- Specified by:
toTypein interfaceIConverter
-
toType
- Specified by:
toTypein interfaceIConverter
-
toString
-
toString
- Specified by:
toStringin interfaceIConverter
-
toString
- Specified by:
toStringin interfaceIConverter
-
isConvertible
-
getConverter
-