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
-
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.
-
Field Details
-
STRING
public static final java.lang.String STRING- See Also:
- Constant Field Values
-
BOOLEAN
public static final java.lang.String BOOLEAN- See Also:
- Constant Field Values
-
NUMBER
public static final java.lang.String NUMBER- See Also:
- Constant Field Values
-
NODE
public static final java.lang.String NODE- See Also:
- Constant Field Values
-
NODE_LIST
public static final java.lang.String NODE_LIST- See Also:
- Constant Field Values
-
DOCUMENT_LIST
public static final java.lang.String DOCUMENT_LIST- See Also:
- Constant Field Values
-
-
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 anXPathExpression
. 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 ofNodeMapper
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 aNode
;org.springframework.xml.xpath.XPathException
- - if the xpath expression can't be evaluated.
-