Package com.helger.commons.typeconvert
Interface ITypeConverterRule<SRC,DST>
-
- Type Parameters:
SRC- source typeDST- destination type
- All Superinterfaces:
Function<SRC,DST>,ITypeConverter<SRC,DST>
- All Known Implementing Classes:
AbstractTypeConverterRule,TypeConverterRuleAnySourceFixedDestination,TypeConverterRuleAssignableSourceFixedDestination,TypeConverterRuleFixedSourceAnyDestination,TypeConverterRuleFixedSourceAssignableDestination
public interface ITypeConverterRule<SRC,DST> extends ITypeConverter<SRC,DST>
Flexible type converter that can handle multiple source and/or destination classes.- Author:
- Philip Helger
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classITypeConverterRule.ESubTypeDefine the sub types of the rules.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanConvert(Class<?> aSrcClass, Class<?> aDstClass)Check if this converter can handle the conversion from the passed source to the passed destination class.ITypeConverterRule.ESubTypegetSubType()-
Methods inherited from interface com.helger.commons.typeconvert.ITypeConverter
apply
-
-
-
-
Method Detail
-
getSubType
@Nonnull ITypeConverterRule.ESubType getSubType()
- Returns:
- The sub type of the converter rule. May not be
null.
-
canConvert
boolean canConvert(@Nonnull Class<?> aSrcClass, @Nonnull Class<?> aDstClass)
Check if this converter can handle the conversion from the passed source to the passed destination class. Note: as this method is called for every type conversion for which no exact converters are present, the implementation of this method should be as efficient as possible.- Parameters:
aSrcClass- Source class to convert from. Nevernull.aDstClass- Destination class to convert to. Nevernull.- Returns:
trueif conversion is possible,falseotherwise.
-
-