public class ObjectToMapTransformer extends AbstractPayloadTransformer<Object,Map<?,?>>
setShouldFlattenKeys(boolean) method.
It supports Collections, Maps and Arrays which means that for flat maps it will flatten
an Object's properties. Below is an example showing how a flattened
Object hierarchy is represented when 'shouldFlattenKeys' is TRUE.
The transformation is based on to and then from JSON conversion.
public class Person {
public String name = "John";
public Address address = new Address();
}
public class Address {
private String street = "123 Main Street";
}
The resulting Map would look like this:
{name=John, address.street=123 Main Street}
JsonObjectMapperProviderEXPRESSION_PARSER, logger| Constructor and Description |
|---|
ObjectToMapTransformer()
Construct with the default
JsonObjectMapper instance available via
factory. |
ObjectToMapTransformer(JsonObjectMapper<?,?> jsonObjectMapper)
Construct with the provided
JsonObjectMapper instance. |
| Modifier and Type | Method and Description |
|---|---|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
void |
setShouldFlattenKeys(boolean shouldFlattenKeys) |
protected Map<String,Object> |
transformPayload(Object payload) |
doTransformtransformafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringpublic ObjectToMapTransformer()
JsonObjectMapper instance available via
factory.public ObjectToMapTransformer(JsonObjectMapper<?,?> jsonObjectMapper)
JsonObjectMapper instance.jsonObjectMapper - the JsonObjectMapper to use.public void setShouldFlattenKeys(boolean shouldFlattenKeys)
protected Map<String,Object> transformPayload(Object payload)
transformPayload in class AbstractPayloadTransformer<Object,Map<?,?>>public String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupport