protected String elementsToString() { List<String> els = new ArrayList<>(elements.getCardinality()); for (int i = 0; i < elements.getCardinality(); i++) { els.add(elements.getChild(i).toString()); } return StringUtils.join(els, ", "); }
@Override public void appendStructure(StringBuilder b, Bindings bindings) { b.append(bindings != null && bindings.isFunctionBound(index) ? "<fn>" : name); params.appendStructure(b, bindings); }
for (int i = 0; i < astParameters.getCardinality(); i++) { filterParams.add(astParameters.getChild(i)); v = createAstMethod(filterProperty, new AstParameters(filterParams)); // function("filter:" + filterName, new AstParameters(filterParams)); } while ("|".equals(getToken().getImage())); } else if ("is".equals(getToken().getImage()) && v = createAstMethod(exptestProperty, new AstParameters(exptestParams)); } else if ("is".equals(getToken().getImage()) && lookahead(0).getSymbol() == IDENTIFIER) { v = createAstMethod(exptestProperty, new AstParameters(exptestParams));
protected AstParameters params(Symbol left, Symbol right) throws ScanException, ParseException { consumeToken(left); List<AstNode> l = Collections.emptyList(); AstNode v = expr(false); if (v != null) { l = new ArrayList<>(); l.add(v); while (getToken().getSymbol() == COMMA) { consumeToken(); l.add(expr(true)); } } consumeToken(right); return new AstParameters(l); }
public int getParamCount() { return params.getCardinality(); }
protected AstNode getParam(int i) { return params.getChild(i); }
protected Object eval(Bindings bindings, ELContext context, boolean answerNullIfBaseIsNull) { Object base = property.getPrefix().eval(bindings, context); if (base == null) { if (answerNullIfBaseIsNull) { return null; } throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", property.getPrefix())); } Object method = property.getProperty(bindings, context); if (method == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(method, String.class); context.setPropertyResolved(false); Object result = context.getELResolver().invoke(context, base, name, null, params.eval(bindings, context)); if (!context.isPropertyResolved()) { throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); } return result; }
/** * params := <LPAREN> (expr (<COMMA> expr)*)? <RPAREN> */ protected AstParameters params() throws ScanException, ParseException { consumeToken(LPAREN); List<AstNode> l = Collections.emptyList(); AstNode v = expr(false); if (v != null) { l = new ArrayList<AstNode>(); l.add(v); while (token.getSymbol() == COMMA) { consumeToken(); l.add(expr(true)); } } consumeToken(RPAREN); return new AstParameters(l); }
public int getParamCount() { return params.getCardinality(); }
protected AstNode getParam(int i) { return params.getChild(i); }
protected Object eval(Bindings bindings, ELContext context, boolean answerNullIfBaseIsNull) { Object base = property.getPrefix().eval(bindings, context); if (base == null) { if (answerNullIfBaseIsNull) { return null; } throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", property.getPrefix())); } Object method = property.getProperty(bindings, context); if (method == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(method, String.class); context.setPropertyResolved(false); Object result = context.getELResolver().invoke(context, base, name, null, params.eval(bindings, context)); if (!context.isPropertyResolved()) { throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); } return result; }
@Override public Object eval(Bindings bindings, ELContext context) { List<Object> list = new ArrayList<>(); for (int i = 0; i < elements.getCardinality(); i++) { list.add(elements.getChild(i).eval(bindings, context)); } return new PyList(list); }
/** * params := <LPAREN> (expr (<COMMA> expr)*)? <RPAREN> */ protected AstParameters params() throws ScanException, ParseException { consumeToken(LPAREN); List<AstNode> l = Collections.emptyList(); AstNode v = expr(false); if (v != null) { l = new ArrayList<AstNode>(); l.add(v); while (token.getSymbol() == COMMA) { consumeToken(); l.add(expr(true)); } } consumeToken(RPAREN); return new AstParameters(l); }
@Override public void appendStructure(StringBuilder builder, Bindings bindings) { property.appendStructure(builder, bindings); params.appendStructure(builder, bindings); }
@Override public void appendStructure(StringBuilder builder, Bindings bindings) { property.appendStructure(builder, bindings); params.appendStructure(builder, bindings); }
@Override public void appendStructure(StringBuilder b, Bindings bindings) { b.append(bindings != null && bindings.isFunctionBound(index) ? "<fn>" : name); params.appendStructure(b, bindings); }