public class ComboExpression extends Expression
"(<expr1> <exprOp> <expr2> <exprOp> <expr3> ...)"
. Only outputs non-empty
expressions in the expression list.Modifier and Type | Class and Description |
---|---|
static class |
ComboExpression.Op
Enum representing the combo mathematical operations supported in a SQL
expression, e.g.
|
EMPTY
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
ComboExpression(ComboExpression.Op comboOp) |
ComboExpression(ComboExpression.Op comboOp,
Object... expressions)
|
ComboExpression(Object comboOpStr,
Object... expressions)
|
Modifier and Type | Method and Description |
---|---|
static ComboExpression |
add()
Convenience method for generating a ComboExpression for joining
expressions using '+'.
|
static ComboExpression |
add(Object... expressions)
Convenience method for generating a ComboExpression for joining
the given expressions using '+'.
|
ComboExpression |
addExpression(Object expr)
Adds the given expression to the list of expression (wrapped
appropriately).
|
ComboExpression |
addExpressions(Object... exprs)
Adds the given expressions to the list of expressions (wrapped
appropriately).
|
protected void |
appendCustomIfNotNull(AppendableExt app,
SqlObject obj)
Appends the given custom clause to the given AppendableExt, handling
null and enclosing parens. |
protected void |
appendNestedClauses(AppendableExt app,
SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Appends the given nested clauses to the given AppendableExt, handling
empty nested clauses and enclosing parens.
|
void |
appendTo(AppendableExt app)
Appends this object to the given AppendableExt.
|
protected static boolean |
areEmpty(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.
|
protected void |
closeParen(AppendableExt app)
Appends a close parenthesis to the given AppendableExt if disableParens is
true , otherwise does nothing. |
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
static ComboExpression |
concatenate()
Convenience method for generating a ComboExpression for joining
expressions using '||'.
|
static ComboExpression |
concatenate(Object... expressions)
Convenience method for generating a ComboExpression for joining
the given expressions using '||'.
|
static ComboExpression |
divide()
Convenience method for generating a ComboExpression for joining
expressions using '/'.
|
static ComboExpression |
divide(Object... expressions)
Convenience method for generating a ComboExpression for joining
the given expressions using '/'.
|
boolean |
hasParens()
Returns
true iff the output of this instance would include
surrounding parentheses, false otherwise. |
protected static boolean |
hasParens(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.
|
boolean |
isDisableParens()
Returns whether or not wrapping parentheses are disabled for this clause
(for clauses which utilize wrapping parentheses).
|
boolean |
isEmpty()
Returns
true iff the output of this instance would be an
empty expression, false otherwise. |
static ComboExpression |
multiply()
Convenience method for generating a ComboExpression for joining
expressions using '*'.
|
static ComboExpression |
multiply(Object... expressions)
Convenience method for generating a ComboExpression for joining
the given expressions using '*'.
|
protected void |
openParen(AppendableExt app)
Appends an open parenthesis to the given AppendableExt if disableParens is
true , otherwise does nothing. |
static ComboExpression |
subtract()
Convenience method for generating a ComboExpression for joining
expressions using '-'.
|
static ComboExpression |
subtract(Object... expressions)
Convenience method for generating a ComboExpression for joining
the given expressions using '-'.
|
setDisableParens
collectSchemaObjects, doValidate, toString
toString, toString
public ComboExpression(ComboExpression.Op comboOp)
public ComboExpression(ComboExpression.Op comboOp, Object... expressions)
protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class SqlObject
vContext
- handle to the current validation contextpublic boolean isEmpty()
true
iff the output of this instance would be an
empty expression, false
otherwise.
Default implementation returns false
.
public boolean hasParens()
true
iff the output of this instance would include
surrounding parentheses, false
otherwise.
Default implementation returns !isEmpty() && !isDisableParens()
.
public ComboExpression addExpression(Object expr)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.
public ComboExpression addExpressions(Object... exprs)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.
public void appendTo(AppendableExt app) throws IOException
Appendee
appendTo
in interface Appendee
appendTo
in class AppendeeObject
app
- the AppendableExt to which this class should append itselfIOException
- if the append failspublic static ComboExpression add()
public static ComboExpression add(Object... expressions)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.public static ComboExpression subtract()
public static ComboExpression subtract(Object... expressions)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.public static ComboExpression multiply()
public static ComboExpression multiply(Object... expressions)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.public static ComboExpression divide()
public static ComboExpression divide(Object... expressions)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.public static ComboExpression concatenate()
public static ComboExpression concatenate(Object... expressions)
Object
-> Expression
conversions handled by
Converter.CUSTOM_TO_EXPRESSION
.public boolean isDisableParens()
false
.protected static boolean areEmpty(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
false
if at least one clause is non-empty, true
otherwiseprotected static boolean hasParens(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
false
if at least one clause is non-empty, true
otherwiseprotected void openParen(AppendableExt app) throws IOException
true
, otherwise does nothing.IOException
protected void closeParen(AppendableExt app) throws IOException
true
, otherwise does nothing.IOException
protected void appendCustomIfNotNull(AppendableExt app, SqlObject obj) throws IOException
null
and enclosing parens.IOException
protected void appendNestedClauses(AppendableExt app, SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses) throws IOException
IOException
Copyright © 2006–2021 OpenHMS. All rights reserved.