org.apache.empire.db.expr.compare
Class DBCompareAndOrExpr

java.lang.Object
  extended by org.apache.empire.db.DBObject
      extended by org.apache.empire.db.DBExpr
          extended by org.apache.empire.db.expr.compare.DBCompareExpr
              extended by org.apache.empire.db.expr.compare.DBCompareAndOrExpr
All Implemented Interfaces:
Serializable

public class DBCompareAndOrExpr
extends DBCompareExpr

This class is used for combining two filter constraints by and / or operator

There is no need to explicitly create instances of this class.
Instead use DBCompareExpr.and(DBCompareExpr) or DBCompareExpr.or(DBCompareExpr)

See Also:
Serialized Form

Field Summary
protected  DBCompareExpr left
           
protected  boolean or
           
protected  DBCompareExpr right
           
 
Fields inherited from class org.apache.empire.db.DBExpr
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESES, CTX_VALUE
 
Constructor Summary
DBCompareAndOrExpr(DBCompareExpr left, DBCompareExpr right, boolean or)
          Constructs a DBCompareColExpr object
 
Method Summary
 void addReferencedColumns(Set<DBColumn> list)
          Internal function to obtain all DBColumnExpr-objects used by this expression.
 void addSQL(StringBuilder buf, long context)
          Creates the SQL-Command sets the specified compare value (the varible boolOP) between the two DBCompareExpr objects.
 DBDatabase getDatabase()
          Returns the current DBDatabase object.
 DBCompareExpr getLeft()
           
 DBCompareExpr getRight()
           
 boolean isMutuallyExclusive(DBCompareExpr other)
          Returns wheter the constraint should replace another one or not.
 boolean isOr()
           
 DBCompareExpr parenthesis()
          wraps the current expression with parenthesis.
 
Methods inherited from class org.apache.empire.db.expr.compare.DBCompareExpr
and, not, or
 
Methods inherited from class org.apache.empire.db.DBExpr
getObjectValue, getValueClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

left

protected final DBCompareExpr left

right

protected final DBCompareExpr right

or

protected final boolean or
Constructor Detail

DBCompareAndOrExpr

public DBCompareAndOrExpr(DBCompareExpr left,
                          DBCompareExpr right,
                          boolean or)
Constructs a DBCompareColExpr object

Parameters:
left - the left side of the expression
right - the right side of the expression
or - true for OR operation, false for AND
Method Detail

getLeft

public DBCompareExpr getLeft()

getRight

public DBCompareExpr getRight()

isOr

public boolean isOr()

getDatabase

public DBDatabase getDatabase()
Returns the current DBDatabase object.

Specified by:
getDatabase in class DBObject
Returns:
the current DBDatabase object

addReferencedColumns

public void addReferencedColumns(Set<DBColumn> list)
Description copied from class: DBExpr
Internal function to obtain all DBColumnExpr-objects used by this expression.

Specified by:
addReferencedColumns in class DBExpr
Parameters:
list - list to which all used column expressions must be added
See Also:
DBExpr.addReferencedColumns(Set)

addSQL

public void addSQL(StringBuilder buf,
                   long context)
Creates the SQL-Command sets the specified compare value (the varible boolOP) between the two DBCompareExpr objects.

Specified by:
addSQL in class DBExpr
Parameters:
buf - the SQL statment
context - the current SQL-Command context

isMutuallyExclusive

public boolean isMutuallyExclusive(DBCompareExpr other)
Returns wheter the constraint should replace another one or not.

Specified by:
isMutuallyExclusive in class DBCompareExpr
Returns:
true it the constraints are mutually exclusive or false otherwise

parenthesis

public DBCompareExpr parenthesis()
wraps the current expression with parenthesis.

Returns:
the new DBCompareColExpr object


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.