public interface GenericConverter
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 influence the conversion logic.
Implementations may additionally implement
|Modifier and Type||Interface and Description|
Holder for a source-to-target class pair.
|Modifier and Type||Method and Description|
Convert the source to the targetType described by the TypeDescriptor.
Return the source and target types which this converter can convert between.
conditional converters this method may return
null to indicate all source-to-target pairs should be considered. *
Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
source- the source object to convert (may be null)
sourceType- the type descriptor of the field we are converting from
targetType- the type descriptor of the field we are converting to