@Test public void testFunctionAfterReduce() { assertFalse(Query.isValidExpression("${allMatchingAttributes('a.*'):contains('2'):count():gt(2)}")); final Map<String, String> attributes = new HashMap<>(); attributes.put("a.1", "245"); attributes.put("a.2", "123"); attributes.put("a.3", "732"); attributes.put("a.4", "343"); attributes.put("a.5", "553"); final String endsWithCount = "${allMatchingAttributes('a.*'):contains('2'):count()}"; assertTrue(Query.isValidExpression(endsWithCount)); verifyEquals(endsWithCount, attributes, 3L); final String usingLiteral = "${literal(" + endsWithCount + "):gt(2)}"; assertTrue(Query.isValidExpression(usingLiteral)); verifyEquals(usingLiteral, attributes, true); attributes.clear(); attributes.put("a1", "123"); attributes.put("a2", "321"); verifyEquals("${allMatchingAttributes('a.*'):contains('2')}", attributes, true); verifyEquals("${allMatchingAttributes('a.*'):contains('2'):toUpper():equals('TRUE')}", attributes, true); verifyEquals("${allMatchingAttributes('a.*'):contains('2'):equals('true'):and( ${literal(true)} )}", attributes, true); }
public static boolean isValidExpression(final String value) { try { validateExpression(value, false); return true; } catch (final AttributeExpressionLanguageParsingException | ProcessException e) { return false; } }
Query { public static boolean isValidExpression(final String value) { try { validateExpression(value, false); return true; } catch (final AttributeExpressionLanguageParsingException | ProcessException e) { return false; } } }
Query { public static boolean isValidExpression(final String value) { try { validateExpression(value, false); return true; } catch (final AttributeExpressionLanguageParsingException | ProcessException e) { return false; } } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); }
Query { public static boolean isValidExpression(final String value) { try { validateExpression(value, false); return true; } catch (final AttributeExpressionLanguageParsingException | ProcessException e) { return false; } } 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 boolean isValidExpression(final String value) { try { validateExpression(value, false); return true; } catch (final AttributeExpressionLanguageParsingException | ProcessException e) { return false; } } 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();  }