Package org.modelmapper.spi
Interface ConditionalConverter<S,D>
-
- Type Parameters:
S
- source typeD
- destination type
- All Superinterfaces:
Converter<S,D>
- All Known Implementing Classes:
StrongTypeConditionalConverter
public interface ConditionalConverter<S,D> extends Converter<S,D>
Conditionally converts matching source objects to instances of destination typeD
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ConditionalConverter.MatchResult
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConditionalConverter.MatchResult
match(Class<?> sourceType, Class<?> destinationType)
Determines whether the converter matches and supports conversion fromsourceType
todestinationType
.
-
-
-
Method Detail
-
match
ConditionalConverter.MatchResult match(Class<?> sourceType, Class<?> destinationType)
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)
.- 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
-
-