Class ExpressionEvaluator
java.lang.Object
dev.vanengine.core.ExpressionEvaluator
Evaluates JavaScript-like expressions against a Java data model.
Supports property access (Map/record/POJO/Collection.length), comparison,
logical, ternary, arithmetic operators, and parentheses.
Thread-safe and stateless — create one instance and reuse.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluate an expression string against the given scope.static booleanCheck truthiness of a value (JavaScript semantics).booleanEvaluate an expression and return its truthiness (matching JavaScript semantics).static ObjectresolvePath(String path, Map<String, ?> scope) Resolve a dot-separated property path against a scope.
-
Constructor Details
-
ExpressionEvaluator
public ExpressionEvaluator()
-
-
Method Details
-
evaluate
Evaluate an expression string against the given scope.- Parameters:
expr- the expression (e.g.ctx.packages.length > 0 && format === 'MAVEN')scope- the data scope (model map, may include loop variables)- Returns:
- the result (Boolean, Number, String, null, or Object)
-
isTruthy
-
isTruthy
Check truthiness of a value (JavaScript semantics). Falsy: null, false, 0, "", empty collection. -
resolvePath
-