org.openanzo.sqlscribe
Class TempTable

java.lang.Object
  extended by org.openanzo.sqlscribe.TempTable
All Implemented Interfaces:
java.lang.Comparable<TempTable>, ITable

public class TempTable
extends java.lang.Object
implements ITable, java.lang.Comparable<TempTable>

Represents a relational database temporary table for use in the query builder framework.

Author:
Joe Betz

Constructor Summary
TempTable(java.lang.String varName)
          Create temporary table with the given name
TempTable(java.lang.String varName, java.lang.String alias)
          Create a temporary table with the given name
 
Method Summary
 int compareTo(TempTable table)
           
 boolean equals(java.lang.Object object)
           
 java.lang.String getAlias()
          Get the table's alias.
 java.lang.String getDeclaration()
          Get the table's declaration string
 int hashCode()
           
 TempTable reAlias(java.lang.String newVar)
          Clone this table with a new variable
 void setTableName(java.util.Map<java.lang.String,java.lang.Object> variables)
          Set the table's name by pulling it out of the variables
 void writeAlias(java.lang.StringBuffer buf)
          Write the table's alias string to a buffer
 void writeDeclaration(java.lang.StringBuffer buf)
          Write the table's declaration string to a buffer
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempTable

public TempTable(java.lang.String varName)
Create temporary table with the given name

Parameters:
varName -

TempTable

public TempTable(java.lang.String varName,
                 java.lang.String alias)
Create a temporary table with the given name

Parameters:
varName - variable name that contains the table name
alias - table's alias name
Method Detail

setTableName

public void setTableName(java.util.Map<java.lang.String,java.lang.Object> variables)
Set the table's name by pulling it out of the variables

Parameters:
variables - containing the tables name

getAlias

public java.lang.String getAlias()
Description copied from interface: ITable
Get the table's alias. Example: FROM TABLE1 alias,TABLE2

Specified by:
getAlias in interface ITable
Returns:
the table's alias

writeAlias

public void writeAlias(java.lang.StringBuffer buf)
Description copied from interface: ITable
Write the table's alias string to a buffer

Specified by:
writeAlias in interface ITable
Parameters:
buf - buffer to which alias string is written

getDeclaration

public java.lang.String getDeclaration()
Description copied from interface: ITable
Get the table's declaration string

Specified by:
getDeclaration in interface ITable
Returns:
the table's declaration string

writeDeclaration

public void writeDeclaration(java.lang.StringBuffer buf)
Description copied from interface: ITable
Write the table's declaration string to a buffer

Specified by:
writeDeclaration in interface ITable
Parameters:
buf - buffer to which the declaration string is written

reAlias

public TempTable reAlias(java.lang.String newVar)
Clone this table with a new variable

Parameters:
newVar - new variable containing the table name
Returns:
new Table with a new alias

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(TempTable table)
Specified by:
compareTo in interface java.lang.Comparable<TempTable>


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.