|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GenericConverter
Generic converter interface for converting between two or more types.
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.
This interface should generally not be used when the simpler Converter
or
ConverterFactory
interfaces are sufficient.
TypeDescriptor
,
Converter
,
ConverterFactory
Nested Class Summary | |
---|---|
static class |
GenericConverter.ConvertiblePair
Holder for a source-to-target class pair. |
Method Summary | |
---|---|
Object |
convert(Object source,
TypeDescriptor sourceType,
TypeDescriptor targetType)
Convert the source to the targetType described by the TypeDescriptor. |
Set<GenericConverter.ConvertiblePair> |
getConvertibleTypes()
Return the source and target types which this converter can convert between. |
Method Detail |
---|
Set<GenericConverter.ConvertiblePair> getConvertibleTypes()
Each entry is a convertible source-to-target type pair.
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 fromtargetType
- the type descriptor of the field we are converting to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |