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(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType,
java.util.function.Function<S,T> typeConverter)
Adds a type converter.
|
<S,T> Impl |
addConverter(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType,
TypeConverter<S,T> typeConverter)
Adds a type converter.
|
<S,T> boolean |
canConvert(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType)
Return whether the given source type is convertible to the given target type.
|
default <T> java.util.Optional<T> |
convert(java.lang.Object object,
Argument<T> targetType)
Attempts to convert the given object to the given target type.
|
default <T> java.util.Optional<T> |
convert(java.lang.Object object,
ArgumentConversionContext<T> context)
Attempts to convert the given object to the given target type.
|
default <T> java.util.Optional<T> |
convert(java.lang.Object object,
java.lang.Class<T> targetType)
Attempts to convert the given object to the given target type.
|
<T> java.util.Optional<T> |
convert(java.lang.Object object,
java.lang.Class<T> targetType,
ConversionContext context)
Attempts to convert the given object to the given target type.
|
default <T> T |
convertRequired(java.lang.Object value,
Argument<T> argument)
Convert the value to the given type.
|
default <T> T |
convertRequired(java.lang.Object value,
java.lang.Class<T> type)
Convert the value to the given type.
|
static final ConversionService<?> SHARED
<S,T> Impl addConverter(java.lang.Class<S> sourceType, java.lang.Class<T> targetType, java.util.function.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(java.lang.Class<S> sourceType, java.lang.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> java.util.Optional<T> convert(java.lang.Object object,
java.lang.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(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType)
S - The generic source typeT - The target source typesourceType - The source typetargetType - The target typedefault <T> java.util.Optional<T> convert(java.lang.Object object,
java.lang.Class<T> targetType)
Optional is returned.T - The generic typeobject - The object to converttargetType - The target typedefault <T> java.util.Optional<T> convert(java.lang.Object object,
Argument<T> targetType)
Optional is returned.T - The generic typeobject - The object to converttargetType - The target typedefault <T> java.util.Optional<T> convert(java.lang.Object object,
ArgumentConversionContext<T> context)
Optional is returned.T - The generic typeobject - The object to convertcontext - The ArgumentConversionContext@Nullable
default <T> T convertRequired(@Nullable
java.lang.Object value,
java.lang.Class<T> type)
T - The generic typevalue - The valuetype - The typeConversionErrorException - if the value cannot be converted@Nullable
default <T> T convertRequired(@Nullable
java.lang.Object value,
Argument<T> argument)
T - The generic typevalue - The valueargument - The argumentConversionErrorException - if the value cannot be converted