public final class DefaultXPathEvaluator extends Object implements XPathEvaluator
Constructor and Description |
---|
DefaultXPathEvaluator(XBProjector projector,
DocumentResolver documentProvider,
String xpath)
Constructor for DefaultXPathEvaluator.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> returnType)
Evaluate the XPath as a value of the given type.
|
<T> T[] |
asArrayOf(Class<T> componentType)
Evaluate the XPath as an array of the given type.
|
boolean |
asBoolean()
Evaluates the XPath as a boolean value.
|
Date |
asDate()
Evaluates the XPath as a Date value.
|
int |
asInt()
Evaluates the XPath as a int value.
|
<T> List<T> |
asListOf(Class<T> componentType)
Evaluate the XPath as a list of the given type.
|
<T> XBAutoMap<T> |
asMapOf(Class<T> componentType)
Evaluate the XPAth as a map of XPath strings to the given component type.
|
String |
asString()
Evaluates the XPath as a String value.
|
static <E> E |
convertToComponentType(InvocationContext invocationContext,
Node item,
Class<?> targetComponentType) |
static List<?> |
evaluateAsList(XPathExpression expression,
Node node,
Method method,
InvocationContext invocationContext)
Perform an XPath evaluation on an invocation context.
|
public DefaultXPathEvaluator(XBProjector projector, DocumentResolver documentProvider, String xpath)
projector
- documentProvider
- xpath
- public boolean asBoolean()
asBoolean
in interface XPathEvaluator
public int asInt()
asInt
in interface XPathEvaluator
public String asString()
asString
in interface XPathEvaluator
public Date asDate()
asDate
in interface XPathEvaluator
public <T> T as(Class<T> returnType)
as
in interface XPathEvaluator
returnType
- Possible values: primitive types (e.g. Short.Type), Projection interfaces, any
class with a String constructor or a String factory method, and org.w3c.Nodepublic <T> T[] asArrayOf(Class<T> componentType)
asArrayOf
in interface XPathEvaluator
componentType
- Possible values: primitive types (e.g. Short.Type), Projection interfaces, any
class with a String constructor or a String factory method, and org.w3c.Nodepublic <T> List<T> asListOf(Class<T> componentType)
asListOf
in interface XPathEvaluator
componentType
- Possible values: primitive types (e.g. Short.Type), Projection interfaces, any
class with a String constructor or a String factory method, and org.w3c.Nodepublic static List<?> evaluateAsList(XPathExpression expression, Node node, Method method, InvocationContext invocationContext) throws XPathExpressionException
expression
- node
- method
- invocationContext
- XPathExpressionException
public static <E> E convertToComponentType(InvocationContext invocationContext, Node item, Class<?> targetComponentType)
invocationContext
- invocation contextitem
- targetComponentType
- public <T> XBAutoMap<T> asMapOf(Class<T> componentType)
XPathEvaluator
asMapOf
in interface XPathEvaluator
componentType
- XPathEvaluator.asMapOf(java.lang.Class)
Copyright © 2012-12-21-2017. All Rights Reserved.