|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.builder.xml.XPathBuilder
public class XPathBuilder
Creates an XPath expression builder which creates a nodeset result by default.
If you want to evaluate a String expression then call stringResult()
XPathConstants.NODESET
Constructor Summary | |
---|---|
XPathBuilder(String text)
|
Method Summary | ||
---|---|---|
void |
assertMatches(String text,
Exchange exchange)
|
|
XPathBuilder |
booleanResult()
Sets the expression result type to boolean |
|
protected XPathFunctionResolver |
createDefaultFunctionResolver(XPathFunctionResolver parent)
|
|
protected XPathExpression |
createXPathExpression()
|
|
Object |
evaluate(Exchange exchange)
|
|
|
evaluate(Exchange exchange,
Class<T> type)
Returns the value of the expression on the given exchange |
|
protected Object |
evaluateAs(Exchange exchange,
QName resultQName)
Evaluates the expression as the given result type |
|
XPathBuilder |
functionResolver(XPathFunctionResolver functionResolver)
Sets the XPathFunctionResolver instance to use on these XPath
expressions |
|
XPathFunction |
getBodyFunction()
|
|
protected Object |
getDocument(Exchange exchange)
Strategy method to extract the document from the exchange |
|
Class |
getDocumentType()
|
|
XPathExpression |
getExpression()
|
|
XPathFunctionResolver |
getFunctionResolver()
|
|
XPathFunction |
getHeaderFunction()
|
|
DefaultNamespaceContext |
getNamespaceContext()
|
|
XPathFunction |
getOutBodyFunction()
|
|
XPathFunction |
getOutHeaderFunction()
|
|
QName |
getResultQName()
|
|
Class |
getResultType()
|
|
String |
getText()
|
|
XPathFactory |
getXPathFactory()
|
|
boolean |
matches(Exchange exchange)
Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate |
|
XPathBuilder |
namespace(String prefix,
String uri)
Registers the namespace prefix and URI with the builder so that the prefix can be used in XPath expressions |
|
XPathBuilder |
namespaces(Namespaces namespaces)
Registers namespaces with the builder so that the registered prefixes can be used in XPath expressions |
|
XPathBuilder |
nodeResult()
Sets the expression result type to boolean |
|
XPathBuilder |
nodeSetResult()
Sets the expression result type to boolean |
|
XPathBuilder |
numberResult()
Sets the expression result type to boolean |
|
XPathBuilder |
objectModel(String uri)
Sets the object model URI to use |
|
protected void |
populateDefaultNamespaces(DefaultNamespaceContext context)
Lets populate a number of standard prefixes if they are not already there |
|
XPathBuilder |
resultType(Class<?> resultType)
Sets the expression result type to boolean |
|
void |
setBodyFunction(XPathFunction bodyFunction)
|
|
void |
setDocumentType(Class documentType)
|
|
void |
setFunctionResolver(XPathFunctionResolver functionResolver)
|
|
void |
setHeaderFunction(XPathFunction headerFunction)
|
|
void |
setNamespaceContext(DefaultNamespaceContext namespaceContext)
|
|
protected void |
setNamespaceIfNotPresent(DefaultNamespaceContext context,
String prefix,
String uri)
|
|
void |
setNamespaces(Map<String,String> namespaces)
Injects the XML Namespaces of prefix -> uri mappings |
|
void |
setOutBodyFunction(XPathFunction outBodyFunction)
|
|
void |
setOutHeaderFunction(XPathFunction outHeaderFunction)
|
|
void |
setResultQName(QName resultQName)
|
|
void |
setResultType(Class resultType)
|
|
void |
setXPathFactory(XPathFactory xpathFactory)
|
|
XPathBuilder |
stringResult()
Sets the expression result type to boolean |
|
String |
toString()
|
|
XPathBuilder |
variable(String name,
Object value)
Registers a variable (in the global namespace) which can be referred to from XPath expressions |
|
static XPathBuilder |
xpath(String text)
|
|
static XPathBuilder |
xpath(String text,
Class resultType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XPathBuilder(String text)
Method Detail |
---|
public static XPathBuilder xpath(String text)
public static XPathBuilder xpath(String text, Class resultType)
public String toString()
toString
in class Object
public boolean matches(Exchange exchange)
Predicate
matches
in interface Predicate
exchange
- the message exchange
public void assertMatches(String text, Exchange exchange) throws AssertionError
AssertionError
public Object evaluate(Exchange exchange)
public <T> T evaluate(Exchange exchange, Class<T> type)
Expression
evaluate
in interface Expression
exchange
- the message exchange on which to evaluate the expressiontype
- the expected type of the evaluation result
public XPathBuilder booleanResult()
public XPathBuilder nodeResult()
public XPathBuilder nodeSetResult()
public XPathBuilder numberResult()
public XPathBuilder stringResult()
public XPathBuilder resultType(Class<?> resultType)
public XPathBuilder objectModel(String uri)
public XPathBuilder functionResolver(XPathFunctionResolver functionResolver)
XPathFunctionResolver
instance to use on these XPath
expressions
public XPathBuilder namespace(String prefix, String uri)
prefix
- is the namespace prefix that can be used in the XPath
expressionsuri
- is the namespace URI to which the prefix refers
public XPathBuilder namespaces(Namespaces namespaces)
namespaces
- is namespaces object that should be used in the
XPath expression
public XPathBuilder variable(String name, Object value)
public XPathFactory getXPathFactory() throws XPathFactoryConfigurationException
XPathFactoryConfigurationException
public void setXPathFactory(XPathFactory xpathFactory)
public Class getDocumentType()
public void setDocumentType(Class documentType)
public String getText()
public QName getResultQName()
public void setResultQName(QName resultQName)
public DefaultNamespaceContext getNamespaceContext()
public void setNamespaceContext(DefaultNamespaceContext namespaceContext)
public XPathFunctionResolver getFunctionResolver()
public void setFunctionResolver(XPathFunctionResolver functionResolver)
public XPathExpression getExpression() throws XPathFactoryConfigurationException, XPathExpressionException
XPathFactoryConfigurationException
XPathExpressionException
public void setNamespaces(Map<String,String> namespaces)
NamespaceAware
setNamespaces
in interface NamespaceAware
namespaces
- the XML namespaces with the key of prefixes and the value the URIspublic XPathFunction getBodyFunction()
public void setBodyFunction(XPathFunction bodyFunction)
public XPathFunction getHeaderFunction()
public void setHeaderFunction(XPathFunction headerFunction)
public XPathFunction getOutBodyFunction()
public void setOutBodyFunction(XPathFunction outBodyFunction)
public XPathFunction getOutHeaderFunction()
public void setOutHeaderFunction(XPathFunction outHeaderFunction)
public Class getResultType()
public void setResultType(Class resultType)
protected Object evaluateAs(Exchange exchange, QName resultQName)
protected XPathExpression createXPathExpression() throws XPathExpressionException, XPathFactoryConfigurationException
XPathExpressionException
XPathFactoryConfigurationException
protected void populateDefaultNamespaces(DefaultNamespaceContext context)
protected void setNamespaceIfNotPresent(DefaultNamespaceContext context, String prefix, String uri)
protected XPathFunctionResolver createDefaultFunctionResolver(XPathFunctionResolver parent)
protected Object getDocument(Exchange exchange)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |