public class BooleanValueObject extends Expression
true
== 1
and false == 0
.
Note, however, that the default values are not SQL 92 compliant
boolean values (although they are preferred by many databases). The values
output by this class can be made SQL 92 compliant by setting the system
property "com.healthmarketscience.sqlbuilder.useBooleanLiterals" to true
. When
this feature is enabled, the values output by this class will be true == TRUE
and false == FALSE
.
Modifier and Type | Field and Description |
---|---|
static BooleanValueObject |
FALSE
BooleanValueObject representing "false"
|
static BooleanValueObject |
TRUE
BooleanValueObject representing "true"
|
static String |
USE_BOOLEAN_LITERALS_PROPERTY |
EMPTY
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
BooleanValueObject(Boolean value) |
BooleanValueObject(Object value) |
Modifier and Type | Method and Description |
---|---|
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.
|
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. |
protected void |
openParen(AppendableExt app)
Appends an open parenthesis to the given AppendableExt if disableParens is
true , otherwise does nothing. |
static BooleanValueObject |
valueOf(boolean value)
Returns a BooleanValueObject for the given boolean value.
|
static BooleanValueObject |
valueOf(Boolean value)
Returns a BooleanValueObject for the given Boolean value.
|
setDisableParens
collectSchemaObjects, doValidate, toString
toString, toString
public static final String USE_BOOLEAN_LITERALS_PROPERTY
public static final BooleanValueObject TRUE
public static final BooleanValueObject FALSE
public BooleanValueObject(Object value)
public BooleanValueObject(Boolean value)
public static BooleanValueObject valueOf(Boolean value)
public static BooleanValueObject valueOf(boolean value)
public boolean hasParens()
true
iff the output of this instance would include
surrounding parentheses, false
otherwise.
Default implementation returns !isEmpty() && !isDisableParens()
.
protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class SqlObject
vContext
- handle to the current validation contextpublic 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 boolean isDisableParens()
false
.public boolean isEmpty()
true
iff the output of this instance would be an
empty expression, false
otherwise.
Default implementation returns 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.