com.caucho.amber.expr
Class AbstractAmberExpr

java.lang.Object
  extended by com.caucho.amber.expr.AbstractAmberExpr
All Implemented Interfaces:
AmberExpr
Direct Known Subclasses:
AbstractPathExpr, AllExpr, AndExpr, AnyExpr, ArgExpr, BetweenExpr, BinaryExpr, BooleanColumnExpr, ColumnExpr, EmptyExpr, EnumExpr, ExistsExpr, FunExpr, InExpr, JoinExpr, KeyPropertyExpr, LikeExpr, LiteralExpr, LoadExpr, MapFieldExpr, MemberExpr, NullExpr, OrExpr, SubSelectExpr, UnaryExpr

public abstract class AbstractAmberExpr
extends java.lang.Object
implements AmberExpr

Represents an Amber query expression


Field Summary
 
Fields inherited from interface com.caucho.amber.expr.AmberExpr
IS_INNER_JOIN, USES_DATA
 
Constructor Summary
AbstractAmberExpr()
           
 
Method Summary
abstract  AmberExpr bindSelect(QueryParser parser)
          Binds the expression as a select item.
 AmberExpr createBoolean()
          Converts to a boolean expression.
 boolean exists()
          Returns true if the expression must exist
 boolean exists(FromItem from)
          Returns true if the expression must exist
 EntityItem findItem(AmberConnection aConn, java.sql.ResultSet rs, int index)
          Returns the object for the expr.
 void generateHaving(CharBuffer cb)
          Generates the having expression.
 void generateJoin(CharBuffer cb)
          Generates the where in a join expression.
 void generateSelect(CharBuffer cb)
          Generates the select expression.
 void generateUpdateWhere(CharBuffer cb)
          Generates the (update) where expression.
 void generateWhere(CharBuffer cb)
          Generates the where expression.
 java.lang.Object getCacheObject(AmberConnection aConn, java.sql.ResultSet rs, int index)
          Returns the object for the expr.
 int getColumnCount()
          Returns the number of columns.
 java.lang.Object getObject(AmberConnection aConn, java.sql.ResultSet rs, int index)
          Returns the object for the expr.
 AmberType getType()
          Returns the expr type.
 boolean hasRelationship()
          Returns true if this expr has any relationship.
 boolean isBoolean()
          Returns true for a boolean expression.
 AmberExpr replaceJoin(JoinExpr join)
          Returns true if the expression uses the from item.
 void setInternalArgType(AmberExpr other)
          Binds the argument type based on another expr.
 boolean usesFrom(FromItem from, int type)
          Returns true if the expression uses the from item.
 boolean usesFrom(FromItem from, int type, boolean isNot)
          Returns true if the expression uses the from item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAmberExpr

public AbstractAmberExpr()
Method Detail

isBoolean

public boolean isBoolean()
Returns true for a boolean expression.

Specified by:
isBoolean in interface AmberExpr

getType

public AmberType getType()
Returns the expr type.

Specified by:
getType in interface AmberExpr

hasRelationship

public boolean hasRelationship()
Returns true if this expr has any relationship.

Specified by:
hasRelationship in interface AmberExpr

createBoolean

public AmberExpr createBoolean()
                        throws QueryParseException
Converts to a boolean expression.

Specified by:
createBoolean in interface AmberExpr
Throws:
QueryParseException

bindSelect

public abstract AmberExpr bindSelect(QueryParser parser)
Binds the expression as a select item.

Specified by:
bindSelect in interface AmberExpr

usesFrom

public boolean usesFrom(FromItem from,
                        int type)
Returns true if the expression uses the from item.

Specified by:
usesFrom in interface AmberExpr

usesFrom

public boolean usesFrom(FromItem from,
                        int type,
                        boolean isNot)
Returns true if the expression uses the from item.

Specified by:
usesFrom in interface AmberExpr

exists

public boolean exists(FromItem from)
Returns true if the expression must exist

Specified by:
exists in interface AmberExpr

exists

public boolean exists()
Returns true if the expression must exist

Specified by:
exists in interface AmberExpr

replaceJoin

public AmberExpr replaceJoin(JoinExpr join)
Returns true if the expression uses the from item.

Specified by:
replaceJoin in interface AmberExpr

getColumnCount

public int getColumnCount()
Returns the number of columns.


generateWhere

public void generateWhere(CharBuffer cb)
Generates the where expression.

Specified by:
generateWhere in interface AmberExpr

generateUpdateWhere

public void generateUpdateWhere(CharBuffer cb)
Generates the (update) where expression.

Specified by:
generateUpdateWhere in interface AmberExpr

generateHaving

public void generateHaving(CharBuffer cb)
Generates the having expression.

Specified by:
generateHaving in interface AmberExpr

generateJoin

public void generateJoin(CharBuffer cb)
Generates the where in a join expression.

Specified by:
generateJoin in interface AmberExpr

generateSelect

public void generateSelect(CharBuffer cb)
Generates the select expression.

Specified by:
generateSelect in interface AmberExpr

getObject

public java.lang.Object getObject(AmberConnection aConn,
                                  java.sql.ResultSet rs,
                                  int index)
                           throws java.sql.SQLException
Returns the object for the expr.

Specified by:
getObject in interface AmberExpr
Throws:
java.sql.SQLException

getCacheObject

public java.lang.Object getCacheObject(AmberConnection aConn,
                                       java.sql.ResultSet rs,
                                       int index)
                                throws java.sql.SQLException
Returns the object for the expr.

Specified by:
getCacheObject in interface AmberExpr
Throws:
java.sql.SQLException

findItem

public EntityItem findItem(AmberConnection aConn,
                           java.sql.ResultSet rs,
                           int index)
                    throws java.sql.SQLException
Returns the object for the expr.

Specified by:
findItem in interface AmberExpr
Throws:
java.sql.SQLException

setInternalArgType

public void setInternalArgType(AmberExpr other)
Binds the argument type based on another expr.

Specified by:
setInternalArgType in interface AmberExpr