- All Known Subinterfaces:
This is the most flexible of the Converter SPI interfaces, but also the most complex.
It is flexible in that a GenericConverter may support converting between multiple source/target
type pairs (see
getConvertibleTypes(). In addition, GenericConverter implementations
have access to source/target
field context during the type conversion
process. This allows for resolving source and target field metadata such as annotations and
generics information, which can be used to influence the conversion logic.
Implementations may additionally implement
Nested Class SummaryModifier and TypeInterfaceDescription
static final classHolder for a source-to-target class pair.
Method SummaryModifier and TypeMethodDescriptionConvert the source object to the targetType described by the
TypeDescriptor.Return the source and target types that this converter can convert between.
getConvertibleTypesReturn the source and target types that this converter can convert between.
Each entry is a convertible source-to-target type pair.
conditional convertersthis method may return
nullto indicate all source-to-target pairs should be considered.
convert@Nullable Object convert
(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType)Convert the source object to the targetType described by the
source- the source object to convert (may be
sourceType- the type descriptor of the field we are converting from
targetType- the type descriptor of the field we are converting to
- the converted object