Package io.beanmapper.core.converter
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 TypeMethodDescription<S,
T> T convert
(BeanMapper beanMapper, S source, Class<T> targetClass, BeanPropertyMatch beanPropertyMatch) Converts the source instance into the desired target type.boolean
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 mappingssource
- the source instancetargetClass
- the desired target typebeanPropertyMatch
- information on the field pair (source / target)- Returns:
- the converted source instance
-
match
Determines whether the conversion of our source type to a target type is supported by this converter.- Parameters:
sourceClass
- the source classtargetClass
- the target class- Returns:
true
if the conversion is supported, elsefalse
-