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

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.DBCompareColExpr
All Implemented Interfaces:
Serializable

public class DBCompareColExpr
extends DBCompareExpr

This class is used for defining filter constraints based on a column expression in SQL

There is no need to explicitly create instances of this class.
Instead use any of the following functions:
DBColumnExpr.is(Object), DBColumnExpr.isBetween(Object, Object), DBColumnExpr.isGreaterThan(Object), DBColumnExpr.isLessOrEqual(Object), DBColumnExpr.isMoreOrEqual(Object), DBColumnExpr.isNot(Object), DBColumnExpr.isNotBetween(Object, Object), DBColumnExpr.isSmallerThan(Object), DBColumnExpr.like(Object), DBColumnExpr.like(String, char), DBColumnExpr.likeLower(String), DBColumnExpr.likeUpper(String)

See Also:
Serialized Form

Field Summary
protected  DBCmpType cmpop
           
protected  DBColumnExpr expr
           
protected  Object value
           
 
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
DBCompareColExpr(DBColumnExpr expr, DBCmpType op, Object value)
          Constructs a DBCompareColExpr object set the specified parameters to this object.
 
Method Summary
 void addCompareExpr(StringBuilder buf, long context)
          Add the comparison operator and value to the SQL-Command.
 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.
 DBCmpType getCmpop()
          Gets the comparison operator
 DBColumnExpr getColumnExpr()
          Gets the DBColumnExpr object
 DBDatabase getDatabase()
          Returns the current DBDatabase object.
 Object getValue()
          Gets the value to compare the column expression with
 boolean isMutuallyExclusive(DBCompareExpr other)
          Returns whether the constraint should replace another one or not.
 void setValue(Object value)
          The value to compare the column expression with
 
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

expr

protected final DBColumnExpr expr

cmpop

protected final DBCmpType cmpop

value

protected Object value
Constructor Detail

DBCompareColExpr

public DBCompareColExpr(DBColumnExpr expr,
                        DBCmpType op,
                        Object value)
Constructs a DBCompareColExpr object set the specified parameters to this object.

Parameters:
expr - the DBColumnExpr object
op - the comparative context e.g. (CMP_EQUAL, CMP_SMALLER)
value - the comparative value
Method Detail

getDatabase

public DBDatabase getDatabase()
Returns the current DBDatabase object.

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

getColumnExpr

public DBColumnExpr getColumnExpr()
Gets the DBColumnExpr object

Returns:
the DBColumnExpr object

getCmpop

public DBCmpType getCmpop()
Gets the comparison operator

Returns:
the comparison operator

getValue

public Object getValue()
Gets the value to compare the column expression with

Returns:
the value to compare the column expression with

setValue

public void setValue(Object value)
The value to compare the column expression with

Parameters:
value - the comparison value

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)

addCompareExpr

public void addCompareExpr(StringBuilder buf,
                           long context)
Add the comparison operator and value to the SQL-Command.

Parameters:
buf - the SQL-Command
context - the comparative context e.g. (CMP_EQUAL, CMP_SMALLER)

addSQL

public void addSQL(StringBuilder buf,
                   long context)
Creates the SQL-Command.

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

isMutuallyExclusive

public boolean isMutuallyExclusive(DBCompareExpr other)
Returns whether 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


Copyright © 2008–2014 Apache Software Foundation. All rights reserved.