Class SimpleBeanConverter<S,T>

java.lang.Object
io.beanmapper.core.converter.AbstractBeanConverter<S,T>
io.beanmapper.core.converter.SimpleBeanConverter<S,T>
All Implemented Interfaces:
BeanConverter
Direct Known Subclasses:
ObjectToStringConverter, StringToBigDecimalConverter, StringToBooleanConverter, StringToByteConverter, StringToDoubleConverter, StringToFloatConverter, StringToIntegerConverter, StringToLongConverter, StringToShortConverter

public abstract class SimpleBeanConverter<S,T> extends AbstractBeanConverter<S,T>
Default converter that should be used for single type-to-type conversions.
Since:
Jun 18, 2015
Author:
Jeroen van Schagen
  • Constructor Details

    • SimpleBeanConverter

      protected SimpleBeanConverter()
      Construct a new bean converter, dynamically resolving the source and target class.
      This constructor requires a dependency to Spring.
    • SimpleBeanConverter

      protected SimpleBeanConverter(Class<?> sourceClass, Class<?> targetClass)
      Construct a new bean converter, manually declaring the source and target class.
      Parameters:
      sourceClass - the source class
      targetClass - the target class
  • Method Details

    • doConvert

      protected final T doConvert(S source, Class<? extends T> targetClass)
      Convert a source instance to the target type.
      Specified by:
      doConvert in class AbstractBeanConverter<S,T>
      Parameters:
      source - the source instance
      targetClass - the class type to convert to
      Returns:
      the converted source instance
    • doConvert

      protected abstract T doConvert(S source)
      Convert the source instance into our target type.
      Parameters:
      source - the source instance
      Returns:
      the converted target