Module org.junit.jupiter.params
Interface StringToObjectConverter
-
- All Known Implementing Classes:
FallbackStringToObjectConverter
,StringToBooleanConverter
,StringToCharacterConverter
,StringToClassConverter
,StringToCommonJavaTypesConverter
,StringToEnumConverter
,StringToJavaTimeConverter
,StringToNumberConverter
interface StringToObjectConverter
Internal API for converting arguments of typeString
to a specified target type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
canConvert(java.lang.Class<?> targetType)
Determine if this converter can convert from aString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead ofint
).java.lang.Object
convert(java.lang.String source, java.lang.Class<?> targetType)
Convert the suppliedString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead ofint
).default java.lang.Object
convert(java.lang.String source, java.lang.Class<?> targetType, java.lang.ClassLoader classLoader)
Convert the suppliedString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead ofint
).
-
-
-
Method Detail
-
canConvert
boolean canConvert(java.lang.Class<?> targetType)
Determine if this converter can convert from aString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead ofint
).
-
convert
java.lang.Object convert(java.lang.String source, java.lang.Class<?> targetType) throws java.lang.Exception
Convert the suppliedString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead 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.Exception
Convert the suppliedString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead 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
-
-