Class XPathUtils

java.lang.Object
org.springframework.integration.xml.xpath.XPathUtils

public final class XPathUtils
extends java.lang.Object
Utility class for 'xpath' support.
Since:
3.0
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String BOOLEAN  
    static java.lang.String DOCUMENT_LIST  
    static java.lang.String NODE  
    static java.lang.String NODE_LIST  
    static java.lang.String NUMBER  
    static java.lang.String STRING  
  • Method Summary

    Modifier and Type Method Description
    static <T> T evaluate​(java.lang.Object object, java.lang.String xpath, java.lang.Object... resultArg)
    Utility method to evaluate an xpath on the provided object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • evaluate

      public static <T> T evaluate​(java.lang.Object object, java.lang.String xpath, java.lang.Object... resultArg)
      Utility method to evaluate an xpath on the provided object. Delegates evaluation to an XPathExpression. Note this method provides the #xpath() SpEL function.
      Type Parameters:
      T - The required return type.
      Parameters:
      object - the xml Object for evaluation.
      xpath - an 'xpath' expression String.
      resultArg - an optional parameter to represent the result type of the xpath evaluation. Only one argument is allowed, which can be an instance of NodeMapper or one of these String constants: "string", "boolean", "number", "node" or "node_list".
      Returns:
      the result of the xpath expression evaluation.
      Throws:
      java.lang.IllegalArgumentException - - if the provided arguments aren't appropriate types or values;
      org.springframework.messaging.MessagingException - - if the provided object can't be converted to a Node;
      org.springframework.xml.xpath.XPathException - - if the xpath expression can't be evaluated.