public class Restrictions extends Object
Constructor and Description |
---|
Restrictions() |
Modifier and Type | Method and Description |
---|---|
static Restriction |
and(Restriction... r)
Combine one or more restrictions with AND:
new restriction = r[0] AND r[1] AND ...
|
static Restriction |
between(Expression e,
Expression low,
Expression high)
Compare if one expression falls between two other expressions:
new expression = low <= e AND e < high.
|
static Restriction |
eq(Expression e1,
Expression e2)
Compare if two expressions are equal: new restriction = e1 == e2.
|
static Restriction |
gt(Expression e1,
Expression e2)
Compare if one expression is greater than another: new restriction = e1 > e2.
|
static Restriction |
gteq(Expression e1,
Expression e2)
Compare if one expression is greater than or equal
to another: new restriction = e1 >= e2.
|
static Restriction |
in(Expression e1,
Expression... e2)
Check if an expression is contained in a set of other expressions:
e1 IN (e2[0], e2[1], ...)
|
static Restriction |
in(Expression e1,
List<Expression> e2)
Check if an expression is contained in a set of other expressions:
e1 IN (e2[0], e2[1], ...)
|
static Restriction |
like(Expression e1,
Expression e2)
Check if one expression matches another: e1 LIKE e2
|
static Restriction |
lt(Expression e1,
Expression e2)
Compare if one expression is less than another: new restriction = e1 < e2.
|
static Restriction |
lteq(Expression e1,
Expression e2)
Compare if one expression is less than or equal
to another: new restriction = e1 <= e2.
|
static Restriction |
neq(Expression e1,
Expression e2)
Compare if two expressions are inequal: new restriction = e1 <> e2.
|
static Restriction |
not(Restriction r)
Negate a restriction: new restriction = NOT r
|
static Restriction |
or(Restriction... r)
Combine one or more restrictions with OR: new restriction = r[0] OR r[1] ...
|
public Restrictions()
public static Restriction and(Restriction... r) throws InvalidDataException
r
- The restrictions to combineInvalidDataException
- If any of the elements is null or
the array doesn't contain at least one elementpublic static Restriction or(Restriction... r) throws InvalidDataException
r
- The restrictions to combineInvalidDataException
- If any of the elements is null or
the array doesn't contain at least one elementpublic static Restriction not(Restriction r) throws InvalidDataException
r
- The restrictions to negateInvalidDataException
- If the restriction is nullpublic static Restriction eq(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expression (optional)InvalidDataException
- If the left expression is nullpublic static Restriction neq(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expression (optional)InvalidDataException
- If the left expression is nullpublic static Restriction gt(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expressionInvalidDataException
- If any of the expressions are nullpublic static Restriction gteq(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expressionInvalidDataException
- If any of the expressions are nullpublic static Restriction lt(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expressionInvalidDataException
- If any of the expressions are nullpublic static Restriction lteq(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expressionInvalidDataException
- If any of the expressions are nullpublic static Restriction between(Expression e, Expression low, Expression high) throws InvalidDataException
e
- The expression to check against the limitslow
- The expression for the low limithigh
- The expression for the high limitInvalidDataException
- If any of the expressions are nullpublic static Restriction in(Expression e1, Expression... e2) throws InvalidDataException
e1
- The expression to checke2
- The set of expression to check againstInvalidDataException
- If any of the expressions are null,
the set contains null values or the set is emptypublic static Restriction in(Expression e1, List<Expression> e2) throws InvalidDataException
e1
- The expression to checke2
- The set of expression to check againstInvalidDataException
- If any of the expressions are null,
the set contains null values or the set is emptypublic static Restriction like(Expression e1, Expression e2) throws InvalidDataException
e1
- The left expressione2
- The right expressionInvalidDataException
- If any of the expressions are null