@Status(stage=TEST, unitTests=COMPLETE) @Review(by="Kees Schotanus", at="2009-10-08", reason="After creation of unit tests") public class WhereClauseRpn extends Object
final WhereClauseRpn whereClause = new WhereClauseRpn();
whereClause.push("a=3").push("b=7").push("c=8").push("d=9");
whereClause.and();
whereClause.or();
whereClause.and();
Constructor and Description |
---|
WhereClauseRpn() |
Modifier and Type | Method and Description |
---|---|
WhereClauseRpn |
and()
Performs an AND operation.
|
List<Object> |
getParameters()
Gets all the JP/QL parameters.
|
WhereClauseRpn |
or()
Performs an OR operation.
|
WhereClauseRpn |
push(String expression)
Pushes the supplied expression on the stack.
|
void |
pushBetween(String column,
Object minimum,
Object maximum)
Pushes a BETWEEN expression, created from the supplied column and minimum and maximum values, on the stack.
|
void |
pushEndsWith(String column,
String value)
Pushes a LIKE expression (where the percent sign is at the beginning of the expression), created from the supplied
column and value on the stack.
|
void |
pushIsNotNull(String column)
Pushes an IS NOT NULL expression, created from the supplied column, on the stack.
|
void |
pushIsNull(String column)
Pushes an IS NULL expression, created from the supplied column, on the stack.
|
void |
pushRelationalExpression(String column,
RelationalOperator operator,
Object value)
Pushes a relational expression, constructed from the supplied column, operator and value on the stack.
|
void |
pushStartsWith(String column,
String value)
Pushes a LIKE expression (where the percent sign is at the end of the expression), created from the supplied column and
value on the stack.
|
String |
toString()
Creates a String representation of this WhereClauseRpn consisting of the where clause (provided the where clause has
been build).
|
public WhereClauseRpn push(String expression)
expression
- The expression to push on the stack.IllegalArgumentException
- When the supplied expression is empty.NullPointerException
- When the supplied expression is null.public void pushRelationalExpression(String column, RelationalOperator operator, Object value)
column
- The column.operator
- The relational operator to apply.value
- The value.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When either the supplied column or operator is null.public void pushStartsWith(String column, String value)
column
- The column.value
- The value.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When the supplied column is null.public void pushEndsWith(String column, String value)
column
- The column.value
- The value.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When the supplied column is null.public void pushBetween(String column, Object minimum, Object maximum)
column
- The column.minimum
- The minimum value.maximum
- The maximum value.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When the supplied column is null.public void pushIsNull(String column)
column
- The column.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When the supplied column is null.public void pushIsNotNull(String column)
column
- The column.IllegalArgumentException
- When the supplied column is empty.NullPointerException
- When the supplied column is null.public WhereClauseRpn and()
NoSuchElementException
- When the stack contains less than two expressions.public WhereClauseRpn or()
NoSuchElementException
- When the stack contains less than two expressions.public String toString()
Copyright © 2008–2018. All rights reserved.