com.onewebsql.query
Class Exp

java.lang.Object
  extended by com.onewebsql.query.Exp
All Implemented Interfaces:
Expression
Direct Known Subclasses:
AExp, LExp

public abstract class Exp
extends Object
implements Expression

Base class for arithmetic and logical expressions.


Field Summary
protected  boolean brackets
          Whether the expression should be put in brackets.
protected  Exp left
          Left subexpression.
protected  String operator
          Operation between left and right subexpression.
protected  Exp right
          Right subexpression.
 
Fields inherited from interface com.onewebsql.query.Expression
COMMA, DOT, LB, QUESTION_MARK, RB, SPACE
 
Constructor Summary
Exp()
          Constructor.
 
Method Summary
abstract  Exp alias(String tableAlias, String columnAlias)
          Returns an expression which represents a reference to the expression using the specified table/column alias.
 Exp aliasColumn(String columnAlias)
          Shorthand for alias(null, columnName).
 Exp aliasTable(String tableAlias)
          Shorthand for alias(tableName, null).
 void build(StringBuilder sb, String schemaName, List<Value> objects, DBAdapter adapter)
          Builds the text of the query (or a part of it) represented by this object.
 boolean equals(Object obj)
           
 int hashCode()
           
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

left

protected Exp left
Left subexpression.


right

protected Exp right
Right subexpression.


operator

protected String operator
Operation between left and right subexpression.


brackets

protected boolean brackets
Whether the expression should be put in brackets.

Constructor Detail

Exp

public Exp()
Constructor.

Method Detail

build

public void build(StringBuilder sb,
                  String schemaName,
                  List<Value> objects,
                  DBAdapter adapter)
Description copied from interface: Expression
Builds the text of the query (or a part of it) represented by this object.

Specified by:
build in interface Expression
Parameters:
sb - StringBuilder to build the query text
schemaName - name of the database schema used to build the query
objects - an accumulator list to which query parameters are appended
adapter - database adapter which builds builds query in a way specific to the database engine

alias

public abstract Exp alias(String tableAlias,
                          String columnAlias)
Returns an expression which represents a reference to the expression using the specified table/column alias.

Parameters:
tableAlias - table alias
columnAlias - column alias
Returns:
aliased expression

aliasTable

public Exp aliasTable(String tableAlias)
Shorthand for alias(tableName, null).

Parameters:
tableAlias - table alias
Returns:
aliased expression

aliasColumn

public Exp aliasColumn(String columnAlias)
Shorthand for alias(null, columnName).

Parameters:
columnAlias - column alias
Returns:
aliased expression

toString

public String toString()
Returns a string representation of the object. The representation consists of the value of the field "name".

Overrides:
toString in class Object
Returns:
a string representation of the object.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2011-2013 e-point SA. All Rights Reserved.