Interface StringToObjectConverter
-
- All Known Implementing Classes:
FallbackStringToObjectConverter,StringToBooleanConverter,StringToCharacterConverter,StringToClassConverter,StringToCommonJavaTypesConverter,StringToEnumConverter,StringToJavaTimeConverter,StringToNumberConverter
interface StringToObjectConverterInternal API for converting arguments of typeStringto a specified target type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanConvert(java.lang.Class<?> targetType)Determine if this converter can convert from aStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).java.lang.Objectconvert(java.lang.String source, java.lang.Class<?> targetType)Convert the suppliedStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).default java.lang.Objectconvert(java.lang.String source, java.lang.Class<?> targetType, java.lang.ClassLoader classLoader)Convert the suppliedStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).
-
-
-
Method Detail
-
canConvert
boolean canConvert(java.lang.Class<?> targetType)
Determine if this converter can convert from aStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).
-
convert
java.lang.Object convert(java.lang.String source, java.lang.Class<?> targetType) throws java.lang.ExceptionConvert the suppliedStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).- Throws:
java.lang.Exception
-
convert
default java.lang.Object convert(java.lang.String source, java.lang.Class<?> targetType, java.lang.ClassLoader classLoader) throws java.lang.ExceptionConvert the suppliedStringto the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integerinstead ofint).The default implementation simply delegates to
convert(String, Class). Can be overridden by concrete implementations of this interface that need access to the suppliedClassLoader.- Throws:
java.lang.Exception
-
-