|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.builder.xml.XPathBuilder<E>
public class XPathBuilder<E extends Exchange>
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,
E exchange)
Allows this predicate to be used nicely in testing to generate a nicely formatted exception and message if this predicate does not match for the given exchange. |
XPathBuilder<E> |
booleanResult()
Sets the expression result type to boolean |
protected XPathFunctionResolver |
createDefaultFunctionResolver(XPathFunctionResolver parent)
|
protected XPathExpression |
createXPathExpression()
|
Object |
evaluate(E exchange)
Returns the value of the expression on the given exchange |
protected Object |
evaluateAs(E exchange,
QName resultQName)
Evaluates the expression as the given result type |
XPathBuilder<E> |
functionResolver(XPathFunctionResolver functionResolver)
Sets the XPathFunctionResolver instance to use on these XPath
expressions |
XPathFunction |
getBodyFunction()
|
protected Object |
getDocument(E 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(E exchange)
Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate |
XPathBuilder<E> |
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<E> |
namespaces(Namespaces namespaces)
Registers namespaces with the builder so that the registered prefixes can be used in XPath expressions |
XPathBuilder<E> |
nodeResult()
Sets the expression result type to boolean |
XPathBuilder<E> |
nodeSetResult()
Sets the expression result type to boolean |
XPathBuilder<E> |
numberResult()
Sets the expression result type to boolean |
XPathBuilder<E> |
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<E> |
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<E> |
stringResult()
Sets the expression result type to boolean |
String |
toString()
|
XPathBuilder<E> |
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)
|
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 String toString()
toString
in class Object
public boolean matches(E exchange)
Predicate
matches
in interface Predicate<E extends Exchange>
exchange
- the message exchange
public void assertMatches(String text, E exchange) throws AssertionError
Predicate
assertMatches
in interface Predicate<E extends Exchange>
text
- the description to use in the exception messageexchange
- the exchange to evaluate the expression on
AssertionError
- if the predicate does not matchpublic Object evaluate(E exchange)
Expression
evaluate
in interface Expression<E extends Exchange>
exchange
- the message exchange on which to evaluate the expression
public XPathBuilder<E> booleanResult()
public XPathBuilder<E> nodeResult()
public XPathBuilder<E> nodeSetResult()
public XPathBuilder<E> numberResult()
public XPathBuilder<E> stringResult()
public XPathBuilder<E> resultType(Class resultType)
public XPathBuilder<E> objectModel(String uri)
public XPathBuilder<E> functionResolver(XPathFunctionResolver functionResolver)
XPathFunctionResolver
instance to use on these XPath
expressions
public XPathBuilder<E> 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<E> namespaces(Namespaces namespaces)
namespaces
- is namespaces object that should be used in the
XPath expression
public XPathBuilder<E> 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(E 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(E exchange)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |