Class TypeConverterRuleFixedSourceAssignableDestination<SRC,DST>
java.lang.Object
com.helger.commons.typeconvert.rule.AbstractTypeConverterRule<SRC,DST>
com.helger.commons.typeconvert.rule.TypeConverterRuleFixedSourceAssignableDestination<SRC,DST>
- Type Parameters:
SRC- Source typeDST- Destination type
- All Implemented Interfaces:
ITypeConverter<SRC,,DST> ITypeConverterRule<SRC,,DST> Function<SRC,DST>
public class TypeConverterRuleFixedSourceAssignableDestination<SRC,DST>
extends AbstractTypeConverterRule<SRC,DST>
Abstract type converter than can convert from a base source class to a
destination class. Example from String.class to specific Enum.class
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.helger.commons.typeconvert.ITypeConverterRule
ITypeConverterRule.ESubType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvert the passed source object to the destination type.final booleancanConvert(Class<?> aSrcClass, Class<?> aDstClass) Check if this converter can handle the conversion from the passed source to the passed destination class.toString()Methods inherited from class com.helger.commons.typeconvert.rule.AbstractTypeConverterRule
getSubType
-
Constructor Details
-
TypeConverterRuleFixedSourceAssignableDestination
-
-
Method Details
-
canConvert
Description copied from interface:ITypeConverterRuleCheck 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.
-
getSourceClass
-
getDestinationClass
-
apply
Description copied from interface:ITypeConverterConvert the passed source object to the destination type.- Parameters:
aSource- The source object to be converted. Cannot benullbecause the type converter already filtersnullvalues!- Returns:
- The converted value. May be
null.
-
toString
- Overrides:
toStringin classAbstractTypeConverterRule<SRC,DST>
-