Java Code Examples for org.apache.el.parser.Node#getImage()

The following examples show how to use org.apache.el.parser.Node#getImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuleVerifyUtils.java    From proctor with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: RuleVerifyUtils.java    From proctor with Apache License 2.0 5 votes vote down vote up
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;
}