Interface ITypeConverterRule<SRC,DST>

Type Parameters:
SRC - source type
DST - 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 enum 
    Define the sub types of the rules.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canConvert(Class<?> aSrcClass, Class<?> aDstClass)
    Check if this converter can handle the conversion from the passed source to the passed destination class.
     

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface com.helger.commons.typeconvert.ITypeConverter

    apply
  • Method Details

    • 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. Never null.
      aDstClass - Destination class to convert to. Never null.
      Returns:
      true if conversion is possible, false otherwise.