diff --git a/build.gradle b/build.gradle index c2e26c28..dbca5bff 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ allprojects { apply plugin: 'jacoco' apply plugin: 'org.owasp.dependencycheck' - version = '3.0.0-a002-SNAPSHOT' + version = '3.0.0-a003-SNAPSHOT' group = 'org.jxls' repositories { diff --git a/jxls/src/main/java/org/jxls/expression/ExpressionEvaluator.java b/jxls/src/main/java/org/jxls/expression/ExpressionEvaluator.java index da7f6a88..3bc86199 100644 --- a/jxls/src/main/java/org/jxls/expression/ExpressionEvaluator.java +++ b/jxls/src/main/java/org/jxls/expression/ExpressionEvaluator.java @@ -19,28 +19,29 @@ public interface ExpressionEvaluator { String getExpression(); /** - * Evaluates if getExpression() is true + * Evaluates if getExpression() is true. * @param context data access * @return expression result (true or false) * @throws JxlsException if return value is not a Boolean or null */ default boolean isConditionTrue(Context context) { - return isConditionTrue(context.toMap()); + return isConditionTrue(getExpression(), context.toMap()); } /** * Evaluates if getExpression() is true. Call this method only if you have no Context. + * @param condition - * @param data - * @return expression result (true or false) * @throws JxlsException if return value is not a Boolean or null */ - default boolean isConditionTrue(Map data) { - Object conditionResult = evaluate(data); + default boolean isConditionTrue(String condition, Map data) { + Object conditionResult = evaluate(condition, data); if (conditionResult instanceof Boolean b) { return Boolean.TRUE.equals(b); } else if (conditionResult == null) { - throw new JxlsException("Result of condition \"" + getExpression() + "\" is null"); + throw new JxlsException("Result of condition \"" + condition + "\" is null"); } - throw new JxlsException("Result of condition \"" + getExpression() + "\" is not a Boolean"); + throw new JxlsException("Result of condition \"" + condition + "\" is not a Boolean"); } }