public final class XPathUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BOOLEAN |
static String |
DOCUMENT_LIST |
static String |
NODE |
static String |
NODE_LIST |
static String |
NUMBER |
static String |
STRING |
Modifier and Type | Method and Description |
---|---|
static <T> T |
evaluate(Object object,
String xpath,
Object... resultArg)
Utility method to evaluate an xpath on the provided object.
|
public static final String STRING
public static final String BOOLEAN
public static final String NUMBER
public static final String NODE
public static final String NODE_LIST
public static final String DOCUMENT_LIST
public static <T> T evaluate(Object object, String xpath, Object... resultArg)
XPathExpression
.
Note this method provides the #xpath()
SpEL function.T
- The required return type.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".IllegalArgumentException
- - if the provided arguments aren't appropriate types or values;MessagingException
- - if the provided
object can't be converted to a Node
;XPathException
- - if the xpath expression can't be evaluated.