@Test public void testAllAttributes() { final Map<String, String> attributes = new HashMap<>(); attributes.put("abc", "1234"); attributes.put("xyz", "4132"); attributes.put("hello", "world!"); verifyEquals("${allAttributes('abc', 'xyz'):matches('\\d+')}", attributes, true); verifyEquals("${allAttributes('abc', 'xyz'):toNumber():lt(99999)}", attributes, true); verifyEquals("${allAttributes('abc', 'hello'):length():gt(3)}", attributes, true); verifyEquals("${allAttributes('abc', 'hello'):length():equals(4)}", attributes, false); verifyEquals("${allAttributes('abc', 'xyz'):length():equals(4)}", attributes, true); verifyEquals("${allAttributes('abc', 'xyz', 'other'):isNull()}", attributes, false); try { Query.compile("${allAttributes('#ah'):equals('hello')"); Assert.fail("Was able to compile with allAttributes and an invalid attribute name"); } catch (final AttributeExpressionLanguageParsingException e) { } }
public static Query compile(final String query) throws AttributeExpressionLanguageParsingException { try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final AttributeExpressionParser parser = new AttributeExpressionParser(lexerTokenStream); final Tree ast = (Tree) parser.query().getTree(); final Tree tree = ast.getChild(0); final Evaluator<?> evaluator = buildEvaluator(tree); verifyMappingEvaluatorReduced(evaluator); return new Query(query, tree, evaluator); } catch (final AttributeExpressionLanguageParsingException e) { throw e; } catch (final Exception e) { throw new AttributeExpressionLanguageParsingException(e); } }
Query { public static Query compile(final String query) throws AttributeExpressionLanguageParsingException { try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final AttributeExpressionParser parser = new AttributeExpressionParser(lexerTokenStream); final Tree ast = (Tree) parser.query().getTree(); final Tree tree = ast.getChild(0); final Evaluator<?> evaluator = buildEvaluator(tree); verifyMappingEvaluatorReduced(evaluator); return new Query(query, tree, evaluator); } catch (final AttributeExpressionLanguageParsingException e) { throw e; } catch (final Exception e) { throw new AttributeExpressionLanguageParsingException(e); } } }
Query { public static Query compile(final String query) throws AttributeExpressionLanguageParsingException { try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final AttributeExpressionParser parser = new AttributeExpressionParser(lexerTokenStream); final Tree ast = (Tree) parser.query().getTree(); final Tree tree = ast.getChild(0); final Evaluator<?> evaluator = buildEvaluator(tree); verifyMappingEvaluatorReduced(evaluator); return new Query(query, tree, evaluator); } catch (final AttributeExpressionLanguageParsingException e) { throw e; } catch (final Exception e) { throw new AttributeExpressionLanguageParsingException(e); } } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); }
Query { public static Query compile(final String query) throws AttributeExpressionLanguageParsingException { try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final AttributeExpressionParser parser = new AttributeExpressionParser(lexerTokenStream); final Tree ast = (Tree) parser.query().getTree(); final Tree tree = ast.getChild(0); final Evaluator<?> evaluator = buildEvaluator(tree); verifyMappingEvaluatorReduced(evaluator); return new Query(query, tree, evaluator); } catch (final AttributeExpressionLanguageParsingException e) { throw e; } catch (final Exception e) { throw new AttributeExpressionLanguageParsingException(e); } } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString(); }
Query { public static Query compile(final String query) throws AttributeExpressionLanguageParsingException { try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final AttributeExpressionParser parser = new AttributeExpressionParser(lexerTokenStream); final Tree ast = (Tree) parser.query().getTree(); final Tree tree = ast.getChild(0); final Evaluator<?> evaluator = buildEvaluator(tree); verifyMappingEvaluatorReduced(evaluator); return new Query(query, tree, evaluator); } catch (final AttributeExpressionLanguageParsingException e) { throw e; } catch (final Exception e) { throw new AttributeExpressionLanguageParsingException(e); } } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString();  }