Class AbstractConverter<SOURCE,TARGET>
java.lang.Object
de.hybris.platform.converters.impl.AbstractConverter<SOURCE,TARGET>
- All Implemented Interfaces:
Populator<SOURCE,,TARGET> Converter<SOURCE,,TARGET> org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean,org.springframework.core.convert.converter.Converter<SOURCE,TARGET>
- Direct Known Subclasses:
AbstractErrorConverter,AbstractPopulatingConverter,CartVoucherValidationErrorConverter,CartVoucherValidationErrorConverter,PosConverter,ProductConverter
public abstract class AbstractConverter<SOURCE,TARGET>
extends Object
implements Converter<SOURCE,TARGET>, Populator<SOURCE,TARGET>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware
Abstract implementation of the Converter interface that also supports the Populator interface. Implementations of
this base type can either be used as a converter or as a populator. When used as a converter the
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConverts the source object, creating a new instance of the destination typeConvert the source object by filling the prototypeprotected TARGETprotected TARGETDeprecated, for removal: This API element is subject to removal in a future version.please inject the target class directly, since it's way faster than the Spring <lookup-method> approach!abstract voidOverride this method to populate the target from the sourcevoidsetBeanName(String name) voidsetTargetClass(Class<TARGET> targetClass) Allows to specify the target object class directly.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.servicelayer.dto.converter.Converter
convertAll, convertAllIgnoreExceptions, getLoggerMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
AbstractConverter
public AbstractConverter()
-
-
Method Details
-
convert
Description copied from interface:ConverterConverts the source object, creating a new instance of the destination type -
convert
Description copied from interface:ConverterConvert the source object by filling the prototype- Specified by:
convertin interfaceConverter<SOURCE,TARGET> - Parameters:
source- the source objectprototype- the prototype to fill- Returns:
- the converted object, identical to the prototype
- Throws:
ConversionException- if an error occurs
-
populate
Override this method to populate the target from the source -
setTargetClass
Allows to specify the target object class directly. Please use that instead of the deprecated <lookup-method name="createTarget" ref="bean"> approach, as it's way faster. -
createFromClass
-
createTarget
Deprecated, for removal: This API element is subject to removal in a future version.please inject the target class directly, since it's way faster than the Spring <lookup-method> approach! -
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getMyBeanName
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-