use of org.apache.camel.model.language.XPathExpression in project camel by apache.
the class ExpressionClauseSupport method xpath.
/**
* Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
* expression</a> with the specified result type on the supplied
* header name's contents
*
* @param text the expression to be evaluated
* @param resultType the return type expected by the expression
* @param headerName the name of the header to apply the expression to
* @return the builder to continue processing the DSL
*/
public T xpath(String text, Class<?> resultType, String headerName) {
XPathExpression expression = new XPathExpression(text);
expression.setHeaderName(headerName);
setExpressionType(expression);
return result;
}
use of org.apache.camel.model.language.XPathExpression in project camel by apache.
the class ExpressionNodeHelper method toExpressionDefinition.
/**
* Determines which {@link ExpressionDefinition} describes the given predicate best possible.
* <p/>
* This implementation will use types such as {@link SimpleExpression}, {@link XPathExpression} etc.
* if the given predicate is detect as such a type.
*
* @param predicate the predicate
* @return a definition which describes the predicate
*/
public static ExpressionDefinition toExpressionDefinition(Predicate predicate) {
if (predicate instanceof SimpleBuilder) {
SimpleBuilder builder = (SimpleBuilder) predicate;
// we keep the original expression by using the constructor that accepts an expression
SimpleExpression answer = new SimpleExpression(builder);
answer.setExpression(builder.getText());
return answer;
} else if (predicate instanceof XPathBuilder) {
XPathBuilder builder = (XPathBuilder) predicate;
// we keep the original expression by using the constructor that accepts an expression
XPathExpression answer = new XPathExpression(builder);
answer.setExpression(builder.getText());
return answer;
} else if (predicate instanceof ValueBuilder) {
// ValueBuilder wraps the actual predicate so unwrap
ValueBuilder builder = (ValueBuilder) predicate;
Expression expression = builder.getExpression();
if (expression instanceof Predicate) {
predicate = (Predicate) expression;
}
}
if (predicate instanceof ExpressionDefinition) {
return (ExpressionDefinition) predicate;
}
return new ExpressionDefinition(predicate);
}
use of org.apache.camel.model.language.XPathExpression in project camel by apache.
the class Namespaces method xpath.
/**
* Creates the XPath expression using the current namespace context
*/
public XPathExpression xpath(String expression, Class<?> resultType) {
XPathExpression answer = xpath(expression);
answer.setResultType(resultType);
return answer;
}
use of org.apache.camel.model.language.XPathExpression in project camel by apache.
the class Namespaces method xpath.
/**
* Creates the XPath expression using the current namespace context
*/
public XPathExpression xpath(String expression) {
XPathExpression answer = new XPathExpression(expression);
configure(answer);
return answer;
}
use of org.apache.camel.model.language.XPathExpression in project camel by apache.
the class ExpressionClauseSupport method xpath.
/**
* Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
* expression</a> on the supplied header name's contents
*
* @param text the expression to be evaluated
* @param headerName the name of the header to apply the expression to
* @return the builder to continue processing the DSL
*/
public T xpath(String text, String headerName) {
XPathExpression expression = new XPathExpression(text);
expression.setHeaderName(headerName);
return expression(expression);
}
Aggregations