public Boolean get(Object o) { // if we've already determined the value, return it if (jexl.containsKey(o) && jexl.get(o) != null) return jexl.get(o); // try and cast the expression JexlVCMatchExp e = (JexlVCMatchExp) o; evaluateExpression(e); return jexl.get(e); }
/** * get all the values of the map. This is an expensive call, since it evaluates all keys that haven't * been evaluated yet. This is fine if you truely want all the keys, but if you only want a portion, or know * the keys you want, you would be better off using get() to get them by name. * @return a collection of boolean values, representing the results of all the variants evaluated */ public Collection<Boolean> values() { // this is an expensive call for (JexlVCMatchExp exp : jexl.keySet()) if (jexl.get(exp) == null) evaluateExpression(exp); return jexl.values(); }
/** * Get all the values of the map, i.e. the {@link Boolean} values. * This is an expensive call, since it evaluates all keys that haven't been evaluated yet. * This is fine if you truly want all the keys, but if you only want a portion, or know * the keys you want, you would be better off using get() to get them by name. * * Note: due to laziness, this accessor actually modifies the instance by possibly forcing evaluation of an Jexl expression. * * @return a collection of boolean values, representing the results of all the variants evaluated * * @throws IllegalArgumentException when any of the JexlVCMatchExp (i.e. keys) contains invalid Jexl expressions. */ @Override public Collection<Boolean> values() { for (final JexlVCMatchExp exp : jexl.keySet()) { jexl.computeIfAbsent(exp, k -> evaluateExpression(exp)); } return jexl.values(); }
/** * Get all the values of the map, i.e. the {@link Boolean} values. * This is an expensive call, since it evaluates all keys that haven't been evaluated yet. * This is fine if you truly want all the keys, but if you only want a portion, or know * the keys you want, you would be better off using get() to get them by name. * * Note: due to laziness, this accessor actually modifies the instance by possibly forcing evaluation of an Jexl expression. * * @return a collection of boolean values, representing the results of all the variants evaluated * * @throws IllegalArgumentException when any of the JexlVCMatchExp (i.e. keys) contains invalid Jexl expressions. */ @Override public Collection<Boolean> values() { for (final JexlVCMatchExp exp : jexl.keySet()) { jexl.computeIfAbsent(exp, k -> evaluateExpression(exp)); } return jexl.values(); }
/** * Note: due to laziness, this accessor actually modifies the instance by possibly forcing evaluation of an Jexl expression. * * @throws IllegalArgumentException when {@code key} is {@code null} or * when any of the JexlVCMatchExp (i.e. keys) contains invalid Jexl expressions. */ @Override public Boolean get(Object key) { if (key == null) { throw new IllegalArgumentException("Query key is null"); } // if we've already determined the value, return it final Boolean value = jexl.get(key); if (jexl.containsKey(key) && value != null) { return value; } // otherwise cast the expression and try again final JexlVCMatchExp exp = (JexlVCMatchExp) key; final boolean matches = evaluateExpression(exp); jexl.put(exp, matches); return matches; }
/** * Note: due to laziness, this accessor actually modifies the instance by possibly forcing evaluation of an Jexl expression. * * @throws IllegalArgumentException when {@code key} is {@code null} or * when any of the JexlVCMatchExp (i.e. keys) contains invalid Jexl expressions. */ @Override public Boolean get(Object key) { if (key == null) { throw new IllegalArgumentException("Query key is null"); } // if we've already determined the value, return it final Boolean value = jexl.get(key); if (jexl.containsKey(key) && value != null) { return value; } // otherwise cast the expression and try again final JexlVCMatchExp exp = (JexlVCMatchExp) key; final boolean matches = evaluateExpression(exp); jexl.put(exp, matches); return matches; }