Class UnmarshallingTransformer

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,​java.lang.Object>
org.springframework.integration.xml.transformer.UnmarshallingTransformer
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, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.transformer.GenericTransformer<org.springframework.messaging.Message<?>,​org.springframework.messaging.Message<?>>, org.springframework.integration.transformer.Transformer

public class UnmarshallingTransformer
extends org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,​java.lang.Object>
An implementation of Transformer that delegates to an OXM Unmarshaller. Expects the payload to be of type Document, String, File, Source or to have an instance of SourceFactory that can convert to a Source. If alwaysUseSourceFactory is set to true, then the SourceFactory will be used to create the Source regardless of payload type.

The alwaysUseSourceFactory is ignored if payload is MimeMessage.

The Unmarshaller may return a Message, but if the return value is not already a Message instance, a new Message will be created with that return value as its payload.

  • Field Summary

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger
  • Constructor Summary

    Constructors 
    Constructor Description
    UnmarshallingTransformer​(org.springframework.oxm.Unmarshaller unmarshaller)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getComponentType()  
    void setAlwaysUseSourceFactory​(boolean alwaysUseSourceFactory)
    If true always delegate to the SourceFactory.
    void setSourceFactory​(SourceFactory sourceFactory)
    Provide the SourceFactory to be used.
    java.lang.Object 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • setSourceFactory

      public void setSourceFactory​(SourceFactory sourceFactory)
      Provide the SourceFactory to be used. Must not be null.
      Parameters:
      sourceFactory - The source factory.
    • setAlwaysUseSourceFactory

      public void setAlwaysUseSourceFactory​(boolean alwaysUseSourceFactory)
      If true always delegate to the SourceFactory.
      Parameters:
      alwaysUseSourceFactory - true to always use the source factory.
    • getComponentType

      public java.lang.String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.context.IntegrationObjectSupport
    • transformPayload

      public java.lang.Object transformPayload​(java.lang.Object payload)
      Specified by:
      transformPayload in class org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,​java.lang.Object>