Spring Integration

org.springframework.integration.transformer
Class ObjectToMapTransformer

java.lang.Object
  extended by org.springframework.integration.transformer.AbstractTransformer
      extended by org.springframework.integration.transformer.AbstractPayloadTransformer<Object,Map<?,?>>
          extended by org.springframework.integration.transformer.ObjectToMapTransformer
All Implemented Interfaces:
Transformer

public class ObjectToMapTransformer
extends AbstractPayloadTransformer<Object,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
Author:
Oleg Zhurakousky

Constructor Summary
ObjectToMapTransformer()
           
 
Method Summary
protected  Map<String,Object> transformPayload(Object payload)
           
 
Methods inherited from class org.springframework.integration.transformer.AbstractPayloadTransformer
doTransform
 
Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectToMapTransformer

public ObjectToMapTransformer()
Method Detail

transformPayload

protected Map<String,Object> transformPayload(Object payload)
                                       throws Exception
Specified by:
transformPayload in class AbstractPayloadTransformer<Object,Map<?,?>>
Throws:
Exception

Spring Integration

Copyright © 2010. All Rights Reserved.