Impl - The typepublic interface ConversionService<Impl extends ConversionService>
| Modifier and Type | Field and Description |
|---|---|
static ConversionService<?> |
SHARED
The default shared conversion service.
|
| Modifier and Type | Method and Description |
|---|---|
<S,T> Impl |
addConverter(Class<S> sourceType,
Class<T> targetType,
Function<S,T> typeConverter)
Adds a type converter.
|
<S,T> Impl |
addConverter(Class<S> sourceType,
Class<T> targetType,
TypeConverter<S,T> typeConverter)
Adds a type converter.
|
<S,T> boolean |
canConvert(Class<S> sourceType,
Class<T> targetType)
Return whether the given source type is convertible to the given target type.
|
default <T> Optional<T> |
convert(Object object,
Argument<T> targetType)
Attempts to convert the given object to the given target type.
|
default <T> Optional<T> |
convert(Object object,
ArgumentConversionContext<T> context)
Attempts to convert the given object to the given target type.
|
default <T> Optional<T> |
convert(Object object,
Class<T> targetType)
Attempts to convert the given object to the given target type.
|
<T> Optional<T> |
convert(Object object,
Class<T> targetType,
ConversionContext context)
Attempts to convert the given object to the given target type.
|
default <T> T |
convertRequired(Object value,
Argument<T> argument)
Convert the value to the given type.
|
default <T> T |
convertRequired(Object value,
Class<T> type)
Convert the value to the given type.
|
static final ConversionService<?> SHARED
<S,T> Impl addConverter(Class<S> sourceType, Class<T> targetType, Function<S,T> typeConverter)
S - The source generic typeT - The target generic typesourceType - The source typetargetType - The target typetypeConverter - The type converter<S,T> Impl addConverter(Class<S> sourceType, Class<T> targetType, TypeConverter<S,T> typeConverter)
S - The source generic typeT - The target generic typesourceType - The source typetargetType - The target typetypeConverter - The type converter<T> Optional<T> convert(Object object, Class<T> targetType, ConversionContext context)
Optional is returned.T - The generic typeobject - The object to converttargetType - The target typecontext - The conversion context<S,T> boolean canConvert(Class<S> sourceType, Class<T> targetType)
S - The generic source typeT - The target source typesourceType - The source typetargetType - The target typedefault <T> Optional<T> convert(Object object, Class<T> targetType)
Optional is returned.T - The generic typeobject - The object to converttargetType - The target typedefault <T> Optional<T> convert(Object object, Argument<T> targetType)
Optional is returned.T - The generic typeobject - The object to converttargetType - The target typedefault <T> Optional<T> convert(Object object, ArgumentConversionContext<T> context)
Optional is returned.T - The generic typeobject - The object to convertcontext - The ArgumentConversionContext@Nullable default <T> T convertRequired(@Nullable Object value, Class<T> type)
T - The generic typevalue - The valuetype - The typeConversionErrorException - if the value cannot be converted@Nullable default <T> T convertRequired(@Nullable Object value, Argument<T> argument)
T - The generic typevalue - The valueargument - The argumentConversionErrorException - if the value cannot be converted