Class UnmarshallingTransformer

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ComponentSourceAware, ExpressionCapable, GenericTransformer<Message<?>, Message<?>>, NamedComponent, Transformer

public class UnmarshallingTransformer extends AbstractPayloadTransformer<Object,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.

Author:
Jonas Partner, Artem Bilan, Gary Russell, Ngoc Nhan
  • Constructor Details

    • UnmarshallingTransformer

      public UnmarshallingTransformer(Unmarshaller unmarshaller)
  • 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 String getComponentType()
    • transformPayload

      public Object transformPayload(Object payload)
      Specified by:
      transformPayload in class AbstractPayloadTransformer<Object,Object>