@API(status=INTERNAL,
since="5.0")
public class DefaultArgumentConverter
extends java.lang.Object
implements ArgumentConverter
DefaultArgumentConverter is the default implementation of the
ArgumentConverter API.
The DefaultArgumentConverter is able to convert from strings to a
number of primitive types and their corresponding wrapper types (Byte, Short,
Integer, Long, Float, and Double), date and time types from the
java.time package, and some additional common Java types such as
File, BigDecimal, BigInteger, Currency,
Locale, URI, URL, UUID, etc.
If the source and target types are identical the source object will not be modified.
ArgumentConverter| Modifier and Type | Field and Description |
|---|---|
static DefaultArgumentConverter |
INSTANCE |
private static java.util.List<StringToObjectConverter> |
stringToObjectConverters |
| Modifier | Constructor and Description |
|---|---|
private |
DefaultArgumentConverter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
convert(java.lang.Object source,
java.lang.Class<?> targetType,
ParameterContext context) |
java.lang.Object |
convert(java.lang.Object source,
ParameterContext context)
Convert the supplied
source object according to the supplied
context. |
private static java.lang.Class<?> |
toWrapperType(java.lang.Class<?> targetType) |
public static final DefaultArgumentConverter INSTANCE
private static final java.util.List<StringToObjectConverter> stringToObjectConverters
public final java.lang.Object convert(java.lang.Object source,
ParameterContext context)
ArgumentConvertersource object according to the supplied
context.convert in interface ArgumentConvertersource - the source object to convert; may be nullcontext - the parameter context where the converted object will be
used; never nullnull but only if the target
type is a reference typepublic final java.lang.Object convert(java.lang.Object source,
java.lang.Class<?> targetType,
ParameterContext context)
private static java.lang.Class<?> toWrapperType(java.lang.Class<?> targetType)