@Override public void accept(NodeVisitor visitor) throws Exception { visitor.visit(this); if (this.children != null && this.children.length > 0) { for (int i = 0; i < this.children.length; i++) { this.children[i].accept(visitor); } } }
private static Node checkUndefinedIdentifier(final Node node, final ELContext elContext, final Set<String> absentIdentifiers) { if (node instanceof AstIdentifier) { final String name = node.getImage(); final boolean hasVariable = elContext.getVariableMapper().resolveVariable(name) != null; if (!hasVariable && !absentIdentifiers.contains(name)) { return node; } } else { for (int i = 0; i < node.jjtGetNumChildren(); i++) { final Node result = checkUndefinedIdentifier(node.jjtGetChild(i), elContext, absentIdentifiers); if (result != null) { return result; } } } return null; }
private static void find(final Node node, final List<Node> res) { if (node.jjtGetNumChildren() > 0) { for (int i = 0; i < node.jjtGetNumChildren(); i++) { find(node.jjtGetChild(i), res); } } else { res.add(node); } } }
private final Target getTarget(EvaluationContext ctx) throws ELException { Object base = this.children[0].getValue(ctx); "error.unreachable.base", this.children[0].getImage())); if (propCount > 1) { while (base != null && i < propCount) { property = this.children[i].getValue(ctx); ctx.setPropertyResolved(false); base = resolver.getValue(ctx, base, property); property = this.children[i].getValue(ctx);
/** * @since EL 3.0 */ @Override public boolean isParametersProvided() { return this.getNode().isParametersProvided(); }
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { return this.children[0].getType(ctx); }
@Override public Object getValue(EvaluationContext ctx) throws ELException { return this.children[0].getValue(ctx); } }
public boolean isParametersProvided() { if (jjtGetNumChildren() > 1 && this.children[1] != null && this.children[1] instanceof AstDotSuffix) { return (this.children[1].jjtGetNumChildren()) > 0; } return false; }
private Node build() throws ELException { Node n = createNodeInternal(this.expression); this.prepare(n); if (n instanceof AstDeferredExpression || n instanceof AstDynamicExpression) { n = n.jjtGetChild(0); } return n; }
public ValueReference getValueReference(ELContext context) { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().getValueReference(ctx); }
/** * Evaluates the expression relative to the provided context, and returns * information about the actual referenced method. * * @param context * The context of this evaluation * @return an instance of <code>MethodInfo</code> containing information * about the method the expression evaluated to. * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext) */ public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { Node n = this.getNode(); EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return n.getMethodInfo(ctx, this.paramTypes); }
EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().invoke(ctx, this.paramTypes, params);
private static boolean isIgnorable(final Node node, final Set<String> absentIdentifiers) { final List<Node> leaves = getLeafNodes(node); for (final Node n : leaves) { final String image = n.getImage(); if (absentIdentifiers.contains(image)) { /* we can ignore this test failure since the identifier context is not provided **/ return true; } } return false; }
private final Target getTarget(EvaluationContext ctx) throws ELException { Object base = this.children[0].getValue(ctx); throw new PropertyNotFoundException(MESSAGES.errorResolvingIdentifierType(this.children[0].getImage())); if (propCount > 1) { while (base != null && i < propCount) { property = this.children[i].getValue(ctx); ctx.setPropertyResolved(false); base = resolver.getValue(ctx, base, property); property = this.children[i].getValue(ctx);
private static void find(final Node node, final List<Node> res) { if (node.jjtGetNumChildren() > 0) { for (int i = 0; i < node.jjtGetNumChildren(); i++) { find(node.jjtGetChild(i), res); } } else { res.add(node); } } }
/** * @since EL 3.0 */ @Override public boolean isParametersProvided() { return this.getNode().isParametersProvided(); }
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { return this.children[0].getType(ctx); }
@Override public Object getValue(EvaluationContext ctx) throws ELException { return this.children[0].getValue(ctx); }
private void setNestedState(NestedState nestedState) { if (this.nestedState != null) { // Should never happen throw new IllegalStateException("nestedState may only be set once"); } this.nestedState = nestedState; // Increment the nesting count for the current expression nestedState.incrementNestingCount(); if (jjtGetNumChildren() > 1) { Node firstChild = jjtGetChild(0); if (firstChild instanceof AstLambdaParameters) { if (firstChild.jjtGetNumChildren() > 0) { nestedState.setHasFormalParameters(); } } else { // Can't be a lambda expression return; } Node secondChild = jjtGetChild(1); if (secondChild instanceof AstLambdaExpression) { ((AstLambdaExpression) secondChild).setNestedState(nestedState); } } }