use of org.apache.camel.Expression in project camel by apache.
the class ValueBuilder method tokenize.
public ValueBuilder tokenize(String token, int group, boolean skipFirst) {
Expression newExp = ExpressionBuilder.tokenizeExpression(expression, token);
if (group == 0 && skipFirst) {
// wrap in skip first (if group then it has its own skip first logic)
newExp = ExpressionBuilder.skipFirstExpression(newExp);
}
newExp = ExpressionBuilder.groupIteratorExpression(newExp, token, group, skipFirst);
return onNewValueBuilder(newExp);
}
use of org.apache.camel.Expression in project camel by apache.
the class ValueBuilder method in.
public Predicate in(Object... values) {
List<Predicate> predicates = new ArrayList<Predicate>();
for (Object value : values) {
Expression right = asExpression(value);
right = ExpressionBuilder.convertToExpression(right, expression);
Predicate predicate = onNewPredicate(PredicateBuilder.isEqualTo(expression, right));
predicates.add(predicate);
}
return in(predicates.toArray(new Predicate[predicates.size()]));
}
use of org.apache.camel.Expression in project camel by apache.
the class ValueBuilder method xtokenize.
public ValueBuilder xtokenize(String path, char mode, Namespaces namespaces) {
Expression newExp = ExpressionBuilder.tokenizeXMLAwareExpression(path, mode);
((NamespaceAware) newExp).setNamespaces(namespaces.getNamespaces());
return onNewValueBuilder(newExp);
}
use of org.apache.camel.Expression in project camel by apache.
the class XPathBuilder method createSimpleFunction.
private XPathFunction createSimpleFunction() {
return new XPathFunction() {
@SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (!list.isEmpty()) {
Object value = list.get(0);
if (value != null) {
String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
Language simple = exchange.get().getContext().resolveLanguage("simple");
Expression exp = simple.createExpression(text);
Object answer = exp.evaluate(exchange.get(), Object.class);
return answer;
}
}
return null;
}
};
}
use of org.apache.camel.Expression in project camel by apache.
the class MethodInfo method createParameterExpressions.
protected Expression[] createParameterExpressions() {
final int size = parameters.size();
LOG.trace("Creating parameters expression for {} parameters", size);
final Expression[] expressions = new Expression[size];
for (int i = 0; i < size; i++) {
Expression parameterExpression = parameters.get(i).getExpression();
expressions[i] = parameterExpression;
LOG.trace("Parameter #{} has expression: {}", i, parameterExpression);
}
return expressions;
}
Aggregations