use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method unaryExpr.
public final Expression unaryExpr() throws ParseException {
String s = null;
Expression left = null;
if (jj_2_6(2147483647)) {
jj_consume_token(40);
left = unaryExpr();
} else {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 41:
jj_consume_token(41);
left = unaryExpr();
left = UnaryExpression.createNegate(left);
break;
case NOT:
jj_consume_token(NOT);
left = unaryExpr();
left = UnaryExpression.createNOT(asBooleanExpression(left));
break;
case TRUE:
case FALSE:
case NULL:
case DECIMAL_LITERAL:
case HEX_LITERAL:
case OCTAL_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
case FUNCTIONNAME:
case ID:
case QUOTED_ID:
case 37:
left = primaryExpr();
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method orderByClauseElement.
public final OrderByExpression orderByClauseElement() throws ParseException {
Expression expr;
OrderByExpression orderByExpr;
OrderByExpression.Order order = OrderByExpression.Order.ASC;
expr = addExpression();
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ASC:
case DESC:
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ASC:
jj_consume_token(ASC);
break;
case DESC:
jj_consume_token(DESC);
order = OrderByExpression.Order.DESC;
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
;
}
{
if (true)
return new OrderByExpression(expr, order);
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method functionExpression.
public final Expression functionExpression() throws ParseException {
String s;
Token t;
List<Expression> args = new ArrayList<Expression>();
Expression expr;
t = jj_consume_token(FUNCTIONNAME);
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case NOT:
case TRUE:
case FALSE:
case NULL:
case DECIMAL_LITERAL:
case HEX_LITERAL:
case OCTAL_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
case FUNCTIONNAME:
case ID:
case QUOTED_ID:
case 37:
case 40:
case 41:
expr = addExpression();
args.add(expr);
label_9: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 38:
;
break;
default:
break label_9;
}
jj_consume_token(38);
expr = addExpression();
args.add(expr);
}
break;
default:
;
}
jj_consume_token(39);
{
if (true)
return _factory.createFunctionExpression(t.image.substring(0, t.image.length() - 1), args);
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class ConfiguredObjectQuery method parseOrderByClause.
private List<OrderByExpression> parseOrderByClause(final String orderByClause, final HeadersAndValueExpressions headersAndValue) {
final List<OrderByExpression> orderByExpressions;
ConfiguredObjectFilterParser parser = new ConfiguredObjectFilterParser();
parser.setConfiguredObjectExpressionFactory(new ConfiguredObjectExpressionFactory() {
@Override
public ConfiguredObjectExpression createConfiguredObjectExpression(final String propertyName) {
if (headersAndValue.hasHeader(propertyName)) {
Expression expression = headersAndValue.getValueExpressionForHeader(propertyName);
return object -> expression.evaluate(object);
} else {
return super.createConfiguredObjectExpression(propertyName);
}
}
});
try {
orderByExpressions = parser.parseOrderBy(orderByClause);
} catch (ParseException | TokenMgrError e) {
throw new SelectorParsingException("Unable to parse orderBy clause", e);
}
return orderByExpressions;
}
use of org.apache.qpid.server.filter.Expression in project qpid-broker-j by apache.
the class SelectorParser method andExpression.
public final Expression andExpression() throws ParseException {
Expression left;
Expression right;
left = equalityExpression();
label_2: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case AND:
;
break;
default:
break label_2;
}
jj_consume_token(AND);
right = equalityExpression();
left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
}
{
if (true)
return left;
}
throw new Error("Missing return statement in function");
}
Aggregations