org.springframework.integration.transformer
Class ObjectToMapTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,java.util.Map<?,?>>
org.springframework.integration.transformer.ObjectToMapTransformer
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, NamedComponent, Transformer
public class ObjectToMapTransformer
- extends AbstractPayloadTransformer<java.lang.Object,java.util.Map<?,?>>
Will transform an object graph into a flat Map where keys are valid SpEL expressions
and values are of java.lang.* type. This means that this transformer will recursively navigate
through the Object graph until the value could be java.lang.*
It supports Collections, Maps and Arrays which means it will flatten Object's attributes that are defined as such:
private Map> testMapInMapData;
private List departments;
private String[] akaNames;
private Map> mapWithListData;
The resulting Map structure will look similar to this:
person.address.mapWithListData['mapWithListTestData'][1]=blah
departments[0]=HR
person.lname=Case
- Since:
- 2.0
Method Summary |
protected java.util.Map<java.lang.String,java.lang.Object> |
transformPayload(java.lang.Object payload)
|
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ObjectToMapTransformer
public ObjectToMapTransformer()
transformPayload
protected java.util.Map<java.lang.String,java.lang.Object> transformPayload(java.lang.Object payload)
throws java.lang.Exception
- Specified by:
transformPayload
in class AbstractPayloadTransformer<java.lang.Object,java.util.Map<?,?>>
- Throws:
java.lang.Exception