Package org.modelmapper.spi
Class StrongTypeConditionalConverter<S,D>
- java.lang.Object
-
- org.modelmapper.spi.StrongTypeConditionalConverter<S,D>
-
- All Implemented Interfaces:
Converter<S,D>
,ConditionalConverter<S,D>
public class StrongTypeConditionalConverter<S,D> extends Object implements ConditionalConverter<S,D>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.modelmapper.spi.ConditionalConverter
ConditionalConverter.MatchResult
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description D
convert(MappingContext<S,D> context)
Converts theMappingContext.getSource()
to an instance ofMappingContext.getDestinationType()
.ConditionalConverter.MatchResult
match(Class<?> sourceType, Class<?> destinationType)
Determines whether the converter matches and supports conversion fromsourceType
todestinationType
.static <S,D>
ConditionalConverter<S,D>wrap(Class<S> sourceType, Class<D> destinationType, Converter<S,D> converter)
-
-
-
Method Detail
-
wrap
public static <S,D> ConditionalConverter<S,D> wrap(Class<S> sourceType, Class<D> destinationType, Converter<S,D> converter)
-
match
public ConditionalConverter.MatchResult match(Class<?> sourceType, Class<?> destinationType)
Description copied from interface:ConditionalConverter
Determines whether the converter matches and supports conversion fromsourceType
todestinationType
.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)
.- Specified by:
match
in interfaceConditionalConverter<S,D>
- Parameters:
sourceType
- to matchdestinationType
- to match- Returns:
ConditionalConverter.MatchResult.FULL
ifsourceType
anddestinationType
are matchedConditionalConverter.MatchResult.PARTIAL
ifdestinationType
is matchedConditionalConverter.MatchResult.NONE
ifdestinationType
is not matched
-
convert
public D convert(MappingContext<S,D> context)
Description copied from interface:Converter
Converts theMappingContext.getSource()
to an instance ofMappingContext.getDestinationType()
.
-
-