Class RegexTestXPathMessageSelector

java.lang.Object
org.springframework.integration.xml.selector.AbstractXPathMessageSelector
org.springframework.integration.xml.selector.RegexTestXPathMessageSelector
All Implemented Interfaces:
GenericSelector<Message<?>>, MessageSelector

public class RegexTestXPathMessageSelector extends AbstractXPathMessageSelector
XPath MessageSelector that tests if a provided String value matches a given Regular Expression.
Since:
2.1
Author:
Mark Fisher, Gary Russell
  • Constructor Details

    • RegexTestXPathMessageSelector

      public RegexTestXPathMessageSelector(String expression, Map<String,String> namespaces, String regex)
      Creates a selector which attempts to match the given regex and supports multiple namespaces.
      Parameters:
      expression - XPath expression as a String
      namespaces - Map of namespaces where the keys are namespace prefixes
      regex - regular expression to match
    • RegexTestXPathMessageSelector

      public RegexTestXPathMessageSelector(String expression, String prefix, String namespace, String regex)
      Creates a selector which attempts to match the given regex and supports a single namespace.
      Parameters:
      expression - XPath expression as a String
      prefix - namespace prefix
      namespace - namespace URI
      regex - regular expression to match
    • RegexTestXPathMessageSelector

      public RegexTestXPathMessageSelector(String expression, String regex)
      Creates a non-namespaced selector which attempts to match the given regex.
      Parameters:
      expression - XPath expression as a String
      regex - regular expression to match
    • RegexTestXPathMessageSelector

      public RegexTestXPathMessageSelector(XPathExpression expression, String regex)
      Creates a selector which attempts to match the given regex against the evaluation result of the provided XPathExpression.
      Parameters:
      expression - XPath expression
      regex - regular expression to match
  • Method Details

    • accept

      public boolean accept(Message<?> message)
      Evaluate the payload and return true if the value returned by the XPathExpression matches the regex.