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

pack-priv Class StringToNumberConverter

extends Object
implements StringToObjectConverter
Class Inheritance
All Implemented Interfaces
org.junit.platform.commons.support.conversion.StringToObjectConverter
Imports
java.math.BigDecimal, .BigInteger, java.util.Map, java.util.function.Function, org.junit.platform.commons.util.Preconditions

Field Summary

Modifier and TypeField and Description
private static final Map<Class<?>, Function<String, ?>>

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).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONVERTERSback to summary
private static final Map<Class<?>, Function<String, ?>> CONVERTERS

Constructor Detail

StringToNumberConverterback to summary
pack-priv StringToNumberConverter()

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)

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