|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.mathema.pride.SQLExpression
public class SQLExpression
Convenience class for simplified assembly of SQL expressions
Nested Class Summary | |
---|---|
static interface |
SQLExpression.Direction
|
static interface |
SQLExpression.Operator
|
Field Summary | |
---|---|
static java.lang.String |
REVISION_ID
|
Constructor Summary | |
---|---|
SQLExpression(SQLFormatter formatter)
Create a new empty SQL expression |
|
SQLExpression(SQLFormatter formatter,
java.lang.String expression)
Create a new SQL expression |
|
SQLExpression(SQLFormatter formatter,
java.lang.String expression,
java.lang.String orderByExpression)
Create a new SQL expression |
Method Summary | |
---|---|
SQLExpression |
and(SQLExpression rhsExpression)
|
SQLExpression |
and(java.lang.String rhsExpression)
|
SQLExpression |
and(java.lang.String field,
boolean value)
|
SQLExpression |
and(java.lang.String field,
char value)
|
SQLExpression |
and(java.lang.String field,
double value)
|
SQLExpression |
and(java.lang.String field,
float value)
|
SQLExpression |
and(java.lang.String field,
int value)
|
SQLExpression |
and(java.lang.String field,
long value)
|
SQLExpression |
and(java.lang.String field,
java.lang.Object value)
Returns a new SQLExpression representing the AND concatenation of this object's expression with a field assignment |
SQLExpression |
and(java.lang.String field,
short value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
boolean value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
char value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
double value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
float value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
int value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
long value)
|
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Returns a new SQLExpression representing the AND concatenation of this object's expression and a field operation defined by the passed parameters. |
SQLExpression |
and(java.lang.String field,
java.lang.String operator,
short value)
|
protected SQLExpression |
append(java.lang.String operation,
java.lang.String subExpression)
Appends a sub-expression to this object's expression |
protected java.lang.String |
assign(java.lang.String field,
java.lang.Object value)
Returns an SQL assignment expression for the passed field and value |
SQLExpression |
brace()
Puts this object's expression in braces |
protected java.lang.String |
formatOperator(java.lang.String operator,
java.lang.Object value)
|
protected java.lang.String |
formatValue(java.lang.Object value)
Format the passed value if there has a formatter been passed in the constructor and if the value is not of type SQLRaw |
protected boolean |
isEmpty()
Returns true if the expression, represented by this object is empty, i.e. it is null or an empty string |
protected boolean |
isEmpty(java.lang.String string)
|
protected java.lang.String |
operation(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
|
SQLExpression |
or(SQLExpression rhsExpression)
|
SQLExpression |
or(java.lang.String rhsExpression)
|
SQLExpression |
or(java.lang.String field,
boolean value)
|
SQLExpression |
or(java.lang.String field,
char value)
|
SQLExpression |
or(java.lang.String field,
double value)
|
SQLExpression |
or(java.lang.String field,
float value)
|
SQLExpression |
or(java.lang.String field,
int value)
|
SQLExpression |
or(java.lang.String field,
long value)
|
SQLExpression |
or(java.lang.String field,
java.lang.Object value)
Returns a new SQLExpression representing the OR concatenation of this object's expression with a field assignment |
SQLExpression |
or(java.lang.String field,
short value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
boolean value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
char value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
double value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
float value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
int value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
long value)
|
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Returns a new SQLExpression representing the OR concatenation of this object's expression and a field operation defined by the passed parameters. |
SQLExpression |
or(java.lang.String field,
java.lang.String operator,
short value)
|
SQLExpression |
orderBy(java.lang.String orderExpression)
|
SQLExpression |
orderBy(java.lang.String orderExpression,
java.lang.String direction)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String REVISION_ID
Constructor Detail |
---|
public SQLExpression(SQLFormatter formatter)
formatter
- A formatter object used to format SQL values.
This may e.g. be a Database
object.public SQLExpression(SQLFormatter formatter, java.lang.String expression)
formatter
- A formatter object úsed to format SQL values
This may e.g. be a Database
object.expression
- An initial expressionpublic SQLExpression(SQLFormatter formatter, java.lang.String expression, java.lang.String orderByExpression)
formatter
- A formatter object úsed to format SQL values
This may e.g. be a Database
object.expression
- An initial expressionorderByExpression
- An initial order by expressionMethod Detail |
---|
protected boolean isEmpty()
protected java.lang.String formatValue(java.lang.Object value)
SQLRaw
protected java.lang.String formatOperator(java.lang.String operator, java.lang.Object value)
protected java.lang.String operation(java.lang.String field, java.lang.String operator, java.lang.Object value)
protected java.lang.String assign(java.lang.String field, java.lang.Object value)
protected SQLExpression append(java.lang.String operation, java.lang.String subExpression)
operation
- The appendence operator to use, e.g. AND, OR, ...subExpression
- The sub expression to append
public SQLExpression and(java.lang.String field, java.lang.Object value)
field
- The field to assign a value tovalue
- The value to assign to the specified field. The value will
be formatted by a call to formatValue(java.lang.Object)
.
public SQLExpression and(java.lang.String field, java.lang.String operator, java.lang.Object value)
field
- The field to operate onoperator
- The operator to apply. Supported values are listed in
sub-interface SQLExpression.Operator
.value
- The value to apply. In case of operator SQLExpression.Operator.BETWEEN
,
the value is supposed to be an array of two values. In case of operator
SQLExpression.Operator.IN
, the value is supposed to be an array of arbitrary
length holding the values to compare the denoted field to.
public SQLExpression and(java.lang.String field, boolean value)
public SQLExpression and(java.lang.String field, java.lang.String operator, boolean value)
public SQLExpression and(java.lang.String field, char value)
public SQLExpression and(java.lang.String field, java.lang.String operator, char value)
public SQLExpression and(java.lang.String field, short value)
public SQLExpression and(java.lang.String field, java.lang.String operator, short value)
public SQLExpression and(java.lang.String field, int value)
public SQLExpression and(java.lang.String field, java.lang.String operator, int value)
public SQLExpression and(java.lang.String field, long value)
public SQLExpression and(java.lang.String field, java.lang.String operator, long value)
public SQLExpression and(java.lang.String field, float value)
public SQLExpression and(java.lang.String field, java.lang.String operator, float value)
public SQLExpression and(java.lang.String field, double value)
public SQLExpression and(java.lang.String field, java.lang.String operator, double value)
public SQLExpression and(SQLExpression rhsExpression)
public SQLExpression and(java.lang.String rhsExpression)
public SQLExpression or(java.lang.String field, java.lang.Object value)
field
- The fiels to assign a value tovalue
- The value to assign to the specified field. The value will
be formatted by a call to formatValue(java.lang.Object)
.
public SQLExpression or(java.lang.String field, java.lang.String operator, java.lang.Object value)
field
- The field to operate onoperator
- The operator to apply. Supported values are listed in
sub-interface SQLExpression.Operator
.value
- The value to apply. In case of operator SQLExpression.Operator.BETWEEN
,
the value is supposed to be an array of two values. In case of operator
SQLExpression.Operator.IN
, the value is supposed to be an array of arbitrary
length holding the values to compare the denoted field to.
public SQLExpression or(java.lang.String field, boolean value)
public SQLExpression or(java.lang.String field, java.lang.String operator, boolean value)
public SQLExpression or(java.lang.String field, char value)
public SQLExpression or(java.lang.String field, java.lang.String operator, char value)
public SQLExpression or(java.lang.String field, short value)
public SQLExpression or(java.lang.String field, java.lang.String operator, short value)
public SQLExpression or(java.lang.String field, int value)
public SQLExpression or(java.lang.String field, java.lang.String operator, int value)
public SQLExpression or(java.lang.String field, long value)
public SQLExpression or(java.lang.String field, java.lang.String operator, long value)
public SQLExpression or(java.lang.String field, float value)
public SQLExpression or(java.lang.String field, java.lang.String operator, float value)
public SQLExpression or(java.lang.String field, double value)
public SQLExpression or(java.lang.String field, java.lang.String operator, double value)
public SQLExpression or(SQLExpression rhsExpression)
public SQLExpression or(java.lang.String rhsExpression)
public SQLExpression brace()
public java.lang.String toString()
toString
in class java.lang.Object
public SQLExpression orderBy(java.lang.String orderExpression)
public SQLExpression orderBy(java.lang.String orderExpression, java.lang.String direction)
protected boolean isEmpty(java.lang.String string)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |