Package com.zfabrik.util.expression
Class X
java.lang.Object
com.zfabrik.util.expression.X
- Direct Known Subclasses:
X.BinaryOp
,X.UnaryOp
,X.Val
,X.Var
Simple boolean expression language as a Java expressed DSL.
X
is used in
component repositories to formulate component queries but may be used anywhere where
simple boolean expressions are useful.
A built-in evaluation of an expression over a map defining a context is supported.
For example, given a map m={"a":5, "b":"hello"}
,
var("a").ge(val(6)).and(var("b").eq(val("hello"))).eval(m)would evaluate to
false
while
var("a").le(val(6)).and(var("b").eq(val("hello"))).eval(m)would evaluate to
true
.- Author:
- hb
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
"AND" logical operatorstatic class
Abstract binary operatorsstatic class
"equality" comparison operator.static class
"greater or equal" comparison operator.static class
"greater than" comparison operator.static class
"containment" operator.static class
"less or equal" comparison operator.static class
"less than" comparison operator.static class
"not equals" comparison operator.static class
Negation logical operatorstatic class
"OR" logical operatorstatic class
Abstract single-operand operatorstatic class
Explicit value.static class
Variable of field value operator.static class
"XOR" logical operator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvenience method for chain-style notation of expressions.static X
Static factory method, for convenienceConvenience method for chain-style notation of expressions.static X
Static factory method, for convenienceeval()
abstract Object
Evaluation of the expression over a map style context that defines variable values.eval
(Properties context) Convenience version ofeval(Map)
accepting aProperties
argumentConvenience method for chain-style notation of expressions.Convenience method for chain-style notation of expressions.Convenience method for chain-style notation of expressions.Convenience method for chain-style notation of expressions.Convenience method for chain-style notation of expressions.Convenience method for chain-style notation of expressions.static X
Static factory method, for conveniencenot()
Convenience method for chain-style notation of expressions.static X
Static factory method, for convenienceConvenience method for chain-style notation of expressions.static X
Static factory method, for conveniencestatic X
Static factory method, for conveniencestatic X
Static factory method, for convenienceConvenience method for chain-style notation of expressions.static X
Static factory method, for convenience
-
Constructor Details
-
X
public X()
-
-
Method Details
-
or
Convenience method for chain-style notation of expressions. -
and
Convenience method for chain-style notation of expressions. -
xor
Convenience method for chain-style notation of expressions. -
eq
Convenience method for chain-style notation of expressions. -
lt
Convenience method for chain-style notation of expressions. -
le
Convenience method for chain-style notation of expressions. -
gt
Convenience method for chain-style notation of expressions. -
ge
Convenience method for chain-style notation of expressions. -
in
Convenience method for chain-style notation of expressions. -
neq
Convenience method for chain-style notation of expressions. -
not
Convenience method for chain-style notation of expressions. -
or
Static factory method, for convenience -
and
Static factory method, for convenience -
xor
Static factory method, for convenience -
eq
Static factory method, for convenience -
neq
Static factory method, for convenience -
not
Static factory method, for convenience -
val
Static factory method, for convenience -
var
Static factory method, for convenience -
eval
Evaluation of the expression over a map style context that defines variable values. -
eval
Convenience version ofeval(Map)
accepting aProperties
argument -
eval
-