public class StrongTypeConditionalConverter<S,D> extends Object implements ConditionalConverter<S,D>
ConditionalConverter.MatchResult| Constructor and Description |
|---|
StrongTypeConditionalConverter(Class<S> sourceType,
Class<D> destinationType,
Converter<S,D> converter) |
| Modifier and Type | Method and Description |
|---|---|
D |
convert(MappingContext<S,D> context)
Converts the
MappingContext.getSource() to an instance of
MappingContext.getDestinationType(). |
ConditionalConverter.MatchResult |
match(Class<?> sourceType,
Class<?> destinationType)
Determines whether the converter matches and supports conversion from
sourceType to
destinationType. |
static <S,D> ConditionalConverter<S,D> |
wrap(Class<S> sourceType,
Class<D> destinationType,
Converter<S,D> converter) |
public static <S,D> ConditionalConverter<S,D> wrap(Class<S> sourceType, Class<D> destinationType, Converter<S,D> converter)
public ConditionalConverter.MatchResult match(Class<?> sourceType, Class<?> destinationType)
ConditionalConvertersourceType to
destinationType.
In the case of a partial match, the converter is indicating that it does not recognise the
source type but that it may still be capable performing the conversion implicitly by parsing the
result of calling Object.toString() or by some other means which similarly does not
require knowledge of the type at compile time.
Implicit conversion may result in conversions which are susceptible to unexpected failure when
property types or formats change. Conversion of properties with partially matched types can be
disabled via Configuration.setFullTypeMatchingRequired(boolean).
match in interface ConditionalConverter<S,D>sourceType - to matchdestinationType - to matchConditionalConverter.MatchResult.FULL if sourceType and destinationType are
matchedConditionalConverter.MatchResult.PARTIAL if destinationType is matchedConditionalConverter.MatchResult.NONE if destinationType is not matchedpublic D convert(MappingContext<S,D> context)
ConverterMappingContext.getSource() to an instance of
MappingContext.getDestinationType().Copyright © 2011–2021. All rights reserved.