org.springframework.integration.transformer
Class MapToObjectTransformer
java.lang.Object
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.AbstractPayloadTransformer<Map<?,?>,Object>
org.springframework.integration.transformer.MapToObjectTransformer
- All Implemented Interfaces:
- BeanFactoryAware, Transformer
public class MapToObjectTransformer
- extends AbstractPayloadTransformer<Map<?,?>,Object>
- implements BeanFactoryAware
Will transform Map to an instance of Object. There are two ways to specify the type of the transformed Object.
You can use one of two constructors. The constructor that takes the Class<?> as an argument will construct the Object of
that type. There is another constructor that takes a 'beanName' as an argument and will populate this bean with transformed data.
Such bean must be of 'prototype' scope otherwise MessageTransformationException
will be thrown.
This transformer is integrated with the ConversionService
allowing values in the Map to be converted
to types that represent the properties of the Object.
- Since:
- 2.0
- Author:
- Oleg Zhurakousky
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MapToObjectTransformer
public MapToObjectTransformer(Class<?> targetClass)
- Parameters:
targetClass
-
MapToObjectTransformer
public MapToObjectTransformer(String beanName)
- Parameters:
beanName
-
transformPayload
protected Object transformPayload(Map<?,?> payload)
throws Exception
- Specified by:
transformPayload
in class AbstractPayloadTransformer<Map<?,?>,Object>
- Throws:
Exception
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
throws BeansException
- Specified by:
setBeanFactory
in interface BeanFactoryAware
- Throws:
BeansException
Copyright © 2010. All Rights Reserved.