Class StringToClassConverter
java.lang.Object
org.junit.jupiter.params.converter.StringToClassConverter
- All Implemented Interfaces:
StringToObjectConverter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canConvert
(Class<?> targetType) convert
(String className, Class<?> targetType, ClassLoader classLoader)
-
Constructor Details
-
StringToClassConverter
StringToClassConverter()
-
-
Method Details
-
canConvert
Description copied from interface:StringToObjectConverter
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
).- Specified by:
canConvert
in interfaceStringToObjectConverter
-
convert
Description copied from interface:StringToObjectConverter
Convert the suppliedString
to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example,Integer
instead ofint
).- Specified by:
convert
in interfaceStringToObjectConverter
- Throws:
Exception
-
convert
public Object convert(String className, Class<?> targetType, ClassLoader classLoader) throws Exception Description copied from interface:StringToObjectConverter
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
StringToObjectConverter.convert(String, Class)
. Can be overridden by concrete implementations of this interface that need access to the suppliedClassLoader
.- Specified by:
convert
in interfaceStringToObjectConverter
- Throws:
Exception
-