public abstract class AbstractConverter<SOURCE,TARGET> extends java.lang.Object implements Converter<SOURCE,TARGET>, Populator<SOURCE,TARGET>
createTarget() method is called to create the target instance and then the populate(Object, Object)
method is called to populate the target with values from the source instance. The createTarget() method can
be implemented via a spring lookup-method rather than being overridden in code.| Constructor and Description |
|---|
AbstractConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
TARGET |
convert(SOURCE source)
Converts the source object, creating a new instance of the destination type
|
TARGET |
convert(SOURCE source,
TARGET prototype)
Convert the source object by filling the prototype
|
protected TARGET |
createFromClass() |
protected TARGET |
createTarget()
Deprecated.
please inject the target class directly, since it's way faster than the Spring
|
java.lang.String |
getMyBeanName() |
abstract void |
populate(SOURCE source,
TARGET target)
Override this method to populate the target from the source
|
void |
setBeanName(java.lang.String name) |
void |
setTargetClass(java.lang.Class<TARGET> targetClass)
Allows to specify the target object class directly.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertAll, convertAllIgnoreExceptions, getLoggerpublic TARGET convert(SOURCE source) throws ConversionException
Converterconvert in interface Converter<SOURCE,TARGET>source - the source objectConversionException - if an error occurspublic TARGET convert(SOURCE source, TARGET prototype) throws ConversionException
Converterconvert in interface Converter<SOURCE,TARGET>source - the source objectprototype - the prototype to fillConversionException - if an error occurspublic abstract void populate(SOURCE source, TARGET target)
populate in interface Populator<SOURCE,TARGET>source - the source instancetarget - the target instance to fillsetTargetClass(Class)public void setTargetClass(java.lang.Class<TARGET> targetClass)
protected TARGET createFromClass()
@Deprecated protected TARGET createTarget()
public void setBeanName(java.lang.String name)
public java.lang.String getMyBeanName()
public void afterPropertiesSet()
throws java.lang.Exception
java.lang.ExceptionCopyright © 2018 SAP SE. All Rights Reserved.