private SpelExpression getSpelExpression(Object criteria) { if (criteria instanceof SpelExpression) { return (SpelExpression) criteria; } if (criteria instanceof SpelCriteria) { return getSpelExpression(((SpelCriteria) criteria).getExpression()); } throw new IllegalStateException(String.format("Cannot retrieve SpelExpression from %s", criteria)); }
private SpelExpression getSpelExpression(Object criteria) { if (criteria instanceof SpelExpression) { return (SpelExpression) criteria; } if (criteria instanceof SpelCriteria) { return getSpelExpression(((SpelCriteria) criteria).getExpression()); } throw new IllegalStateException(String.format("Cannot retrieve SpelExpression from %s", criteria)); }
private SpelExpression getSpelExpression(Object criteria) { if (criteria instanceof SpelExpression) { return (SpelExpression) criteria; } if (criteria instanceof SpelCriteria) { return getSpelExpression(((SpelCriteria) criteria).getExpression()); } throw new IllegalStateException(String.format("Cannot retrieve SpelExpression from %s", criteria)); }
@SuppressWarnings("ConstantConditions") private static boolean evaluateExpression(SpelCriteria criteria, Object candidate) { try { return criteria.getExpression().getValue(criteria.getContext(), candidate, Boolean.class); } catch (SpelEvaluationException e) { criteria.getContext().setVariable("it", candidate); return criteria.getExpression().getValue(criteria.getContext()) == null ? false : criteria.getExpression().getValue(criteria.getContext(), Boolean.class); } } }
@SuppressWarnings("ConstantConditions") private static boolean evaluateExpression(SpelCriteria criteria, Object candidate) { try { return criteria.getExpression().getValue(criteria.getContext(), candidate, Boolean.class); } catch (SpelEvaluationException e) { criteria.getContext().setVariable("it", candidate); return criteria.getExpression().getValue(criteria.getContext()) == null ? false : criteria.getExpression().getValue(criteria.getContext(), Boolean.class); } } }
@SuppressWarnings("ConstantConditions") private static boolean evaluateExpression(SpelCriteria criteria, Object candidate) { try { return criteria.getExpression().getValue(criteria.getContext(), candidate, Boolean.class); } catch (SpelEvaluationException e) { criteria.getContext().setVariable("it", candidate); return criteria.getExpression().getValue(criteria.getContext()) == null ? false : criteria.getExpression().getValue(criteria.getContext(), Boolean.class); } } }