Class StringToClassConverter
- java.lang.Object
-
- org.junit.jupiter.params.converter.StringToClassConverter
-
- All Implemented Interfaces:
StringToObjectConverter
class StringToClassConverter extends java.lang.Object implements StringToObjectConverter
-
-
Constructor Summary
Constructors Constructor Description StringToClassConverter()
-
Method Summary
All Methods Instance Methods Concrete 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
).java.lang.Object
convert(java.lang.String className, 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
public boolean canConvert(java.lang.Class<?> targetType)
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
public java.lang.Object convert(java.lang.String source, java.lang.Class<?> targetType) throws java.lang.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
).- Specified by:
convert
in interfaceStringToObjectConverter
- Throws:
java.lang.Exception
-
convert
public java.lang.Object convert(java.lang.String className, java.lang.Class<?> targetType, java.lang.ClassLoader classLoader) throws java.lang.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:
java.lang.Exception
-
-