@Override public Predicate apply(RequestScope dictionary) { return operator.contextualize(getFieldPath(), values, dictionary); }
@Override public Predicate apply(RequestScope dictionary) { return operator.contextualize(getFieldPath(), values, dictionary); }
/** * Applies a filter predicate to the object in question. * * @param object object returned from datastore * @param filterPredicate A predicate from filterExpressionCheck * @param requestScope Request scope object * @return true if the object pass evaluation against Predicate. */ public boolean applyPredicateToObject(T object, FilterPredicate filterPredicate, RequestScope requestScope) { try { String fieldPath = filterPredicate.getFieldPath(); com.yahoo.elide.core.RequestScope scope = coreScope(requestScope); Predicate fn = filterPredicate.getOperator().contextualize(fieldPath, filterPredicate.getValues(), scope); return fn.test(object); } catch (Exception e) { log.error("Failed to apply predicate {}", filterPredicate, e); return false; } }
/** * Applies a filter predicate to the object in question. * * @param object object returned from datastore * @param filterPredicate A predicate from filterExpressionCheck * @param requestScope Request scope object * @return true if the object pass evaluation against Predicate. */ public boolean applyPredicateToObject(T object, FilterPredicate filterPredicate, RequestScope requestScope) { try { String fieldPath = filterPredicate.getFieldPath(); com.yahoo.elide.core.RequestScope scope = coreScope(requestScope); Predicate fn = filterPredicate.getOperator().contextualize(fieldPath, filterPredicate.getValues(), scope); return fn.test(object); } catch (Exception e) { log.error("Failed to apply predicate {}", filterPredicate, e); return false; } }