Class XPathMessageSplitter

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, DiscardingMessageHandler, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class XPathMessageSplitter extends AbstractMessageSplitter
Message Splitter that uses an XPathExpression to split a Document, File or String payload into a NodeList. The return value will be either Strings or Nodes depending on the received payload type. Additionally, node types will be converted to Documents if the 'createDocuments' property is set to true.
Author:
Jonas Partner, Mark Fisher, Artem Bilan, Gary Russell
  • Constructor Details

    • XPathMessageSplitter

      public XPathMessageSplitter(String expression)
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression and TransformerFactory.
      Parameters:
      expression - the xpath expression for splitting.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, Map<String,String> namespaces)
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, Map<String,String> namespaces, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression, namespaces and TransformerFactory.
      Parameters:
      expression - the xpath expression for splitting.
      namespaces - the XML namespace for parsing.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
    • XPathMessageSplitter

      public XPathMessageSplitter(XPathExpression xpathExpression)
    • XPathMessageSplitter

      public XPathMessageSplitter(XPathExpression xpathExpression, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression and TransformerFactory.
      Parameters:
      xpathExpression - the xpath expression for splitting.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
  • Method Details

    • setCreateDocuments

      public void setCreateDocuments(boolean createDocuments)
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class AbstractMessageSplitter
    • setDocumentBuilder

      public void setDocumentBuilder(DocumentBuilderFactory documentBuilderFactory)
    • setXmlPayloadConverter

      public void setXmlPayloadConverter(XmlPayloadConverter xmlPayloadConverter)
    • setIterator

      public void setIterator(boolean iterator)
      The iterator mode: true (default) to return an Iterator for splitting payload, false to return a List.
      Parameters:
      iterator - boolean flag for iterator mode. Default to true.
      Since:
      4.2
    • setOutputProperties

      public void setOutputProperties(Properties outputProperties)
      A set of output properties that will be used to override any of the same properties in affect for the transformation.
      Parameters:
      outputProperties - the Transformer output properties.
      Since:
      4.2
      See Also:
    • doInit

      protected void doInit()
      Overrides:
      doInit in class AbstractMessageSplitter
    • splitMessage

      protected Object splitMessage(Message<?> message)
      Description copied from class: AbstractMessageSplitter
      Subclasses must override this method to split the received Message. The return value may be a Collection or Array. The individual elements may be Messages, but it is not necessary. If the elements are not Messages, each will be provided as the payload of a Message. It is also acceptable to return a single Object or Message. In that case, a single reply Message will be produced.
      Specified by:
      splitMessage in class AbstractMessageSplitter
      Parameters:
      message - The message.
      Returns:
      The result of splitting the message.
    • obtainSizeIfPossible

      protected int obtainSizeIfPossible(Iterator<?> iterator)
      Description copied from class: AbstractMessageSplitter
      Obtain a size of the provided Iterator. Default implementation returns 0.
      Overrides:
      obtainSizeIfPossible in class AbstractMessageSplitter
      Parameters:
      iterator - the Iterator to obtain the size
      Returns:
      the size of the Iterator