Interface BeanConverter

All Known Implementing Classes:
AbstractBeanConverter, AnyToEnumConverter, CollectionConverter, NumberToNumberConverter, ObjectToOptionalConverter, ObjectToStringConverter, OptionalToObjectConverter, PrimitiveConverter, RecordToAnyConverter, SimpleBeanConverter, StringToBigDecimalConverter, StringToBooleanConverter, StringToByteConverter, StringToDoubleConverter, StringToFloatConverter, StringToIntegerConverter, StringToLongConverter, StringToShortConverter

public interface BeanConverter
This class can be inherited if you want to add your own converter to the beanMapper. You must supply the types of both the source and target class. After instantiation of the beanMapper, you can add the converter module by calling the addConverter() method.
  • Method Summary

    Modifier and Type
    Method
    Description
    <S, T> T
    convert(BeanMapper beanMapper, S source, Class<T> targetClass, BeanPropertyMatch beanPropertyMatch)
    Converts the source instance into the desired target type.
    boolean
    match(Class<?> sourceClass, Class<?> targetClass)
    Determines whether the conversion of our source type to a target type is supported by this converter.
  • Method Details

    • convert

      <S, T> T convert(BeanMapper beanMapper, S source, Class<T> targetClass, BeanPropertyMatch beanPropertyMatch)
      Converts the source instance into the desired target type.
      Parameters:
      beanMapper - the instance of BeanMapper to use for further mappings
      source - the source instance
      targetClass - the desired target type
      beanPropertyMatch - information on the field pair (source / target)
      Returns:
      the converted source instance
    • match

      boolean match(Class<?> sourceClass, Class<?> targetClass)
      Determines whether the conversion of our source type to a target type is supported by this converter.
      Parameters:
      sourceClass - the source class
      targetClass - the target class
      Returns:
      true if the conversion is supported, else false