public abstract class AbstractBeanConverter<S,T> extends Object implements BeanConverter
Modifier and Type | Field and Description |
---|---|
protected BeanMapper |
beanMapper |
Constructor and Description |
---|
AbstractBeanConverter()
Construct a new bean converter, dynamically resolving the source and target class.
|
AbstractBeanConverter(Class<?> sourceClass,
Class<?> targetClass)
Construct a new bean converter, manually declaring the source and target class.
|
Modifier and Type | Method and Description |
---|---|
Object |
convert(BeanMapper beanMapper,
Object source,
Class<?> targetClass,
BeanFieldMatch beanFieldMatch)
Converts the source instance into the desired target type.
|
protected abstract Object |
doConvert(S source,
Class<? extends T> targetClass)
Convert a source instance to the target type.
|
protected boolean |
isMatchingSource(Class<?> sourceClass) |
protected boolean |
isMatchingTarget(Class<?> targetClass) |
boolean |
match(Class<?> sourceClass,
Class<?> targetClass)
Determines if the conversion of our source type to a
target type is supported by this converter.
|
protected BeanMapper beanMapper
public AbstractBeanConverter()
public final Object convert(BeanMapper beanMapper, Object source, Class<?> targetClass, BeanFieldMatch beanFieldMatch)
convert
in interface BeanConverter
beanMapper
- the instance of BeanMapper to use for further mappingssource
- the source instancetargetClass
- the desired target typebeanFieldMatch
- information on the field pair (source / target)protected abstract Object doConvert(S source, Class<? extends T> targetClass)
source
- the source instancetargetClass
- the class type to convert topublic final boolean match(Class<?> sourceClass, Class<?> targetClass)
match
in interface BeanConverter
sourceClass
- the source classtargetClass
- the target classtrue
if the conversion is supported, else false
protected boolean isMatchingSource(Class<?> sourceClass)
protected boolean isMatchingTarget(Class<?> targetClass)
Copyright © 2015–2017 42 BV. All rights reserved.