Top Constructors Methods
org.junit.platform.commons.support.conversion

pack-priv Class StringToClassConverter

extends Object
implements StringToObjectConverter
Class Inheritance
All Implemented Interfaces
org.junit.platform.commons.support.conversion.StringToObjectConverter
Imports
org.jspecify.annotations.Nullable, org.junit.platform.commons.support.ReflectionSupport

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
canConvertTo(Class<?> targetType)

Implements org.junit.platform.commons.support.conversion.StringToObjectConverter.canConvertTo.

Determine if this converter can convert from a String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

public Object
convert(String source, Class<?> targetType)

Implements org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

public @Nullable Object
convert(String className, Class<?> targetType, ClassLoader classLoader)

Overrides default org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringToClassConverterback to summary
pack-priv StringToClassConverter()

Method Detail

canConvertToback to summary
public boolean canConvertTo(Class<?> targetType)

Implements org.junit.platform.commons.support.conversion.StringToObjectConverter.canConvertTo.

Doc from org.junit.platform.commons.support.conversion.StringToObjectConverter.canConvertTo.

Determine if this converter can convert from a String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

Annotations
@Override
convertback to summary
public Object convert(String source, Class<?> targetType) throws Exception

Implements org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Doc from org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

This method will only be invoked if canConvertTo(Class) returns true for the same target type.

Annotations
@Override
convertback to summary
public @Nullable Object convert(String className, Class<?> targetType, ClassLoader classLoader) throws Exception

Overrides default org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Doc from org.junit.platform.commons.support.conversion.StringToObjectConverter.convert.

Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

This method will only be invoked if canConvertTo(Class) returns true for the same target type.

The default implementation simply delegates to convert(String, Class). Can be overridden by concrete implementations of this interface that need access to the supplied ClassLoader.

Annotations
@Override