* A generic converter that, as a ConverterMatcher, conditionally executes.
* Often used when selectively matching custom conversion logic based on the presence of a field or class-level annotation.
* For example, when converting from a String to a Date field, an implementation might return true if the target field has also been annotated with <code>@DateTimeFormat</code>.
* A generic converter that conditionally executes.
* Applies a rule that determines if a converter between a set of {@link #getConvertibleTypes() convertible types} matches given a client request to convert between a source field of convertible type S and a target field of convertible type T.
* Often used to selectively match custom conversion logic based on the presence of a field or class-level characteristic, such as an annotation or method.
* For example, when converting from a String field to a Date field, an implementation might return true if the target field has also been annotated with <code>@DateTimeFormat</code>.
* As another example, when converting from a String field to an Account field, an implementation might return true if the target Account class defines a public static findAccount(String) method.
* A rule that determines if a particular Converter of S to T matches given a request to convert between a field of type S and a field of type T.
* Often used to selectively apply custom type conversion logic based on the presence of a field annotation.
* For example, when converting from a String to a Date field, an implementation might return true only if the target Date field has also been annotated with <code>@DateTimeFormat</code>.
* @author Keith Donald
* @since 3.0
* TODO - consider collapsing into ConditionalGenericConverter
*/
publicinterfaceConverterMatcher{
/**
* Should the Converter from <code>sourceType</code> to <code>targetType</code> currently under consideration be selected?
* @param sourceType the type descriptor of the field we are converting from
* @param targetType the type descriptor of the field we are converting to
* @return true if conversion should be performed, false otherwise
* Uniform converter interface as returned from {@link GenericConversionService#getConverter}.
*
* <p>This interface is primarily an internal detail of the {@link GenericConversionService}
* implementation. It should generally not be implemented by application code directly.
* See {@link Converter} and {@link ConverterFactory} interfaces for simpler public converter SPIs.
* Generic converter interface for converting between two or more types.
* <p>
* 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 {@link #getConvertibleTypes()}.
* In addition, GenericConverter implementations have access to source/target {@link TypeDescriptor 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.
* <p>
* This interface should generally not be used when the simpler {@link Converter} or {@link ConverterFactory} interfaces are sufficient.
*
* @author Keith Donald
* @since 3.0
* @see TypeDescriptor
* @see Converter
* @see ConverterFactory
* @see GenericConversionService
*/
publicinterfaceGenericConverter{
/**
* The source and target types this converter can convert between.
* Each entry in the returned array is a two-element array where the first element is a sourceType that can be converted from,
* and the second element is a targetType that can be converted to.
* Each entry in the returned array is a convertible source-to-target type pair, also expressed as an array.
* For each pair, the first array element is a sourceType that can be converted from, and the second array element is a targetType that can be converted to.
*/
publicClass<?>[][]getConvertibleTypes();
/**
* Convert the source to the targetType described by the TypeDescriptor.
* @param source the source object to convert (may be null)
* @param sourceType context about the source type to convert from
* @param targetType context about the target type to convert to
* @param sourceType the type descriptor of the field we are converting from
* @param targetType the type descriptor of the field we are converting to