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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert
(MappingContext<S, D> context) Converts theMappingContext.getSource()
to an instance ofMappingContext.getDestinationType()
.Determines whether the converter matches and supports conversion fromsourceType
todestinationType
.static <S,
D> ConditionalConverter<S, D>
-
Constructor Details
-
StrongTypeConditionalConverter
-
-
Method Details
-
wrap
public static <S,D> ConditionalConverter<S,D> wrap(Class<S> sourceType, Class<D> destinationType, Converter<S, D> converter) -
match
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
Description copied from interface:Converter
Converts theMappingContext.getSource()
to an instance ofMappingContext.getDestinationType()
.
-