org.openanzo.sqlscribe
Class Column

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

public class Column
extends java.lang.Object
implements java.lang.Comparable<Column>

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

Author:
Joe Betz

Constructor Summary
Column(ITable table, java.lang.String name)
          Create new Column with a name and alias
Column(ITable table, java.lang.String name, java.lang.String alias)
          Create new Column with a name and alias
 
Method Summary
 int compareTo(Column column)
           
 boolean equals(java.lang.Object object)
           
 java.lang.String getAlias()
          Get the alias of this column
 java.lang.String getName()
          Get the name of this column
 java.lang.String getQualifiedName()
          Return the qualified name of the column, ie tableAlias.name
 java.lang.String getSelectionName()
          Get the AS selection text for this column, ie: name AS alias
 ITable getTable()
          Get the table to which this column belongs
 int hashCode()
           
 Column reAlias(ITable newTable, java.lang.String newAlias)
          Clone this column using a new table and alias
 java.lang.String toString()
           
 void writeQualifiedName(java.lang.StringBuffer buf)
          Append the qualified name of the column, ie tableAlias.name to a string buffer
 void writeSelectionName(java.lang.StringBuffer buf)
          Append the AS selection text for this column, ie: name AS alias
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Column

public Column(ITable table,
              java.lang.String name,
              java.lang.String alias)
Create new Column with a name and alias

Parameters:
table - table to which this column belongs
name - name of the column
alias - alias to use to reference column in queries

Column

public Column(ITable table,
              java.lang.String name)
Create new Column with a name and alias

Parameters:
table - table to which this column belongs
name - name of the column
Method Detail

getQualifiedName

public java.lang.String getQualifiedName()
Return the qualified name of the column, ie tableAlias.name

Returns:
the qualified name of the column

writeQualifiedName

public void writeQualifiedName(java.lang.StringBuffer buf)
Append the qualified name of the column, ie tableAlias.name to a string buffer

Parameters:
buf - buffer to which name is appended

getSelectionName

public java.lang.String getSelectionName()
Get the AS selection text for this column, ie: name AS alias

Returns:
Get the AS selection text for this column

writeSelectionName

public void writeSelectionName(java.lang.StringBuffer buf)
Append the AS selection text for this column, ie: name AS alias

Parameters:
buf - buffer to which text is appended

getName

public java.lang.String getName()
Get the name of this column

Returns:
name of this column

getAlias

public java.lang.String getAlias()
Get the alias of this column

Returns:
the alias of this column

getTable

public ITable getTable()
Get the table to which this column belongs

Returns:
the table to which this column belongs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

reAlias

public Column reAlias(ITable newTable,
                      java.lang.String newAlias)
Clone this column using a new table and alias

Parameters:
newTable - table where to which the cloned column belongs
newAlias - alias for the new column
Returns:
new Column using a new table and 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(Column column)
Specified by:
compareTo in interface java.lang.Comparable<Column>


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