com.healthmarketscience.sqlbuilder
Class NotCondition

java.lang.Object
  extended by com.healthmarketscience.common.util.AppendeeObject
      extended by com.healthmarketscience.sqlbuilder.SqlObject
          extended by com.healthmarketscience.sqlbuilder.Condition
              extended by com.healthmarketscience.sqlbuilder.NotCondition
All Implemented Interfaces:
Appendee

public class NotCondition
extends Condition

Outputs the negation of the given condition "(NOT <condition>)"

Author:
James Ahlborn

Field Summary
 
Fields inherited from class com.healthmarketscience.sqlbuilder.Condition
EMPTY
 
Fields inherited from class com.healthmarketscience.sqlbuilder.SqlObject
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
 
Constructor Summary
NotCondition(Condition condition)
           
NotCondition(Object condition)
          Object -> Condition conversions handled by Converter.toConditionObject(Object).
 
Method Summary
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)
           
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.
 
Methods inherited from class com.healthmarketscience.sqlbuilder.Condition
setDisableParens
 
Methods inherited from class com.healthmarketscience.sqlbuilder.SqlObject
doValidate, toString
 
Methods inherited from class com.healthmarketscience.common.util.AppendeeObject
toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotCondition

public NotCondition(Object condition)
Object -> Condition conversions handled by Converter.toConditionObject(Object).


NotCondition

public NotCondition(Condition condition)
Method Detail

isEmpty

public boolean isEmpty()
Returns true iff the output of this instance would be an empty expression, false otherwise.

Default implementation returns false.


collectSchemaObjects

protected void collectSchemaObjects(ValidationContext vContext)
Description copied from class: SqlObject
Used during Query.validate() calls to collect the dbschema objects referenced in a query. Any subclass of this class should add all referenced tables and columns to the appropriate collections.

Specified by:
collectSchemaObjects in class SqlObject
Parameters:
vContext - handle to the current validation context

appendTo

public void appendTo(AppendableExt app)
              throws IOException
Specified by:
appendTo in interface Appendee
Overrides:
appendTo in class AppendeeObject
Throws:
IOException

isDisableParens

public boolean isDisableParens()
Returns whether or not wrapping parentheses are disabled for this clause (for clauses which utilize wrapping parentheses). Defaults to false.


hasParens

public boolean hasParens()
Returns true iff the output of this instance would include surrounding parentheses, false otherwise.

Default implementation returns !isEmpty() && !isDisableParens().


areEmpty

protected static boolean areEmpty(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.

Returns:
false if at least one clause is non-empty, true otherwise

hasParens

protected static boolean hasParens(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.

Returns:
false if at least one clause is non-empty, true otherwise

openParen

protected void openParen(AppendableExt app)
                  throws IOException
Appends an open parenthesis to the given AppendableExt if disableParens is true, otherwise does nothing.

Throws:
IOException

closeParen

protected void closeParen(AppendableExt app)
                   throws IOException
Appends a close parenthesis to the given AppendableExt if disableParens is true, otherwise does nothing.

Throws:
IOException

appendCustomIfNotNull

protected void appendCustomIfNotNull(AppendableExt app,
                                     SqlObject obj)
                              throws IOException
Appends the given custom clause to the given AppendableExt, handling null and enclosing parens.

Throws:
IOException

appendNestedClauses

protected void appendNestedClauses(AppendableExt app,
                                   SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
                            throws IOException
Appends the given nested clauses to the given AppendableExt, handling empty nested clauses and enclosing parens.

Throws:
IOException


Copyright © 2006-2012 Health Market Science. All Rights Reserved.