Class ObjectToStringTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,java.lang.String>
org.springframework.integration.transformer.ObjectToStringTransformer
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,ExpressionCapable
,NamedComponent
,GenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>
,Transformer
public class ObjectToStringTransformer extends AbstractPayloadTransformer<java.lang.Object,java.lang.String>
A simple transformer that creates an outbound payload by invoking the
inbound payload Object's
toString()
method. Unless the
payload is a byte[]
or char[]
. If the payload
is a byte[], it will be transformed to a String containing the
array's contents, using the charset
which, by default, is "UTF-8". If the payload is a char[], it will be
transformed to a String object with the array's contents.- Since:
- 1.0.1
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description ObjectToStringTransformer()
ObjectToStringTransformer(java.lang.String charset)
-
Method Summary
Modifier and Type Method Description java.lang.String
getComponentType()
Subclasses may implement this method to provide component type information.protected java.lang.String
transformPayload(java.lang.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 org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, 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, toString
-
Constructor Details
-
ObjectToStringTransformer
public ObjectToStringTransformer() -
ObjectToStringTransformer
public ObjectToStringTransformer(java.lang.String charset)
-
-
Method Details
-
getComponentType
public java.lang.String getComponentType()Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
transformPayload
protected java.lang.String transformPayload(java.lang.Object payload)- Specified by:
transformPayload
in classAbstractPayloadTransformer<java.lang.Object,java.lang.String>
-