|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.zfabrik.util.expression.X
public abstract class X
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.
| Nested Class Summary | |
|---|---|
static class |
X.And
"AND" logical operator |
static class |
X.BinaryOp
Abstract binary operators |
static class |
X.Eq
"equality" comparison operator. |
static class |
X.Ge
"greater or equal" comparison operator. |
static class |
X.Gt
"greater than" comparison operator. |
static class |
X.In
"containment" operator. |
static class |
X.Le
"less or equal" comparison operator. |
static class |
X.Lt
"less than" comparison operator. |
static class |
X.Neq
"not equals" comparison operator. |
static class |
X.Not
Negation logical operator |
static class |
X.Or
"OR" logical operator |
static class |
X.UnaryOp
Abstract single-operand operator |
static class |
X.Val
Explicit value. |
static class |
X.Var
Variable of field value operator. |
static class |
X.Xor
"XOR" logical operator |
| Constructor Summary | |
|---|---|
X()
|
|
| Method Summary | |
|---|---|
X |
and(X x)
Convenience method for chain-style notation of expressions. |
static X |
and(X x,
X y)
Static factory method, for convenience |
X |
eq(X x)
Convenience method for chain-style notation of expressions. |
static X |
eq(X x,
X y)
Static factory method, for convenience |
java.lang.Object |
eval()
Convenience version of eval(Map) that is equivalent to calling eval(Map) with an
empty map or a null argument. |
abstract java.lang.Object |
eval(java.util.Map<java.lang.String,java.lang.Object> context)
Evaluation of the expression over a map style context that defines variable values. |
java.lang.Object |
eval(java.util.Properties context)
Convenience version of eval(Map) accepting a Properties argument |
X |
ge(X x)
Convenience method for chain-style notation of expressions. |
X |
gt(X x)
Convenience method for chain-style notation of expressions. |
X |
in(X x)
Convenience method for chain-style notation of expressions. |
X |
le(X x)
Convenience method for chain-style notation of expressions. |
X |
lt(X x)
Convenience method for chain-style notation of expressions. |
X |
neq(X x)
Convenience method for chain-style notation of expressions. |
static X |
neq(X x,
X y)
Static factory method, for convenience |
X |
not()
Convenience method for chain-style notation of expressions. |
static X |
not(X x)
Static factory method, for convenience |
X |
or(X x)
Convenience method for chain-style notation of expressions. |
static X |
or(X x,
X y)
Static factory method, for convenience |
static X |
val(java.lang.Object val)
Static factory method, for convenience |
static X |
var(java.lang.String name)
Static factory method, for convenience |
X |
xor(X x)
Convenience method for chain-style notation of expressions. |
static X |
xor(X x,
X y)
Static factory method, for convenience |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public X()
| Method Detail |
|---|
public X or(X x)
public X and(X x)
public X xor(X x)
public X eq(X x)
public X lt(X x)
public X le(X x)
public X gt(X x)
public X ge(X x)
public X in(X x)
public X neq(X x)
public X not()
public static X or(X x,
X y)
public static X and(X x,
X y)
public static X xor(X x,
X y)
public static X eq(X x,
X y)
public static X neq(X x,
X y)
public static X not(X x)
public static X val(java.lang.Object val)
public static X var(java.lang.String name)
public abstract java.lang.Object eval(java.util.Map<java.lang.String,java.lang.Object> context)
public java.lang.Object eval(java.util.Properties context)
eval(Map) accepting a Properties argument
public java.lang.Object eval()
eval(Map) that is equivalent to calling eval(Map) with an
empty map or a null argument.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||