com.mckoi.database
Class Variable

java.lang.Object
  extended by com.mckoi.database.Variable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class Variable
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This represents a column name that may be qualified. This object encapsulated a column name that can be fully qualified in the system. Such uses of this object would not typically be used against any context. For example, it would not be desirable to use ColumnName in DataTableDef because the column names contained in DataTableDef are within a known context. This object is intended for use within parser processes where free standing column names with potentially no context are required.

NOTE: This object is NOT immutable.

Author:
Tobias Downer
See Also:
Serialized Form

Constructor Summary
Variable(java.lang.String column_name)
           
Variable(TableName table_name, java.lang.String column_name)
          Constructs the ColumnName.
Variable(Variable v)
           
 
Method Summary
 java.lang.Object clone()
          Performs a deep clone of this object.
 int compareTo(java.lang.Object ob)
          Comparable.
 boolean equals(java.lang.Object ob)
          Equality.
 java.lang.String getName()
          Returns the column name context.
 TableName getTableName()
          Returns the TableName context.
 int hashCode()
          Hash code.
static Variable resolve(java.lang.String name)
          Attempts to resolve a string '[table_name].[column]' to a Variable instance.
static Variable resolve(TableName tname, java.lang.String name)
          Attempts to resolve a string '[table_name].[column]' to a Variable instance.
 Variable resolveTableName(TableName tablen)
          Returns a ColumnName that is resolved against a table name context only if the ColumnName is unknown in this object.
 Variable set(Variable from)
          Sets this Variable object with information from the given Variable.
 void setColumnName(java.lang.String column_name)
          Sets the column name of this variable.
 void setTableName(TableName tname)
          Sets the TableName of this variable.
 java.lang.String toString()
          To string.
 java.lang.String toTechString()
          To a differently formatted string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable(TableName table_name,
                java.lang.String column_name)
Constructs the ColumnName.


Variable

public Variable(java.lang.String column_name)

Variable

public Variable(Variable v)
Method Detail

getTableName

public TableName getTableName()
Returns the TableName context.


getName

public java.lang.String getName()
Returns the column name context.


resolve

public static Variable resolve(java.lang.String name)
Attempts to resolve a string '[table_name].[column]' to a Variable instance.


resolve

public static Variable resolve(TableName tname,
                               java.lang.String name)
Attempts to resolve a string '[table_name].[column]' to a Variable instance. If the table name does not exist, or the table name schema is not specified, then the schema/table name is copied from the given object.


resolveTableName

public Variable resolveTableName(TableName tablen)
Returns a ColumnName that is resolved against a table name context only if the ColumnName is unknown in this object.


set

public Variable set(Variable from)
Sets this Variable object with information from the given Variable.


setColumnName

public void setColumnName(java.lang.String column_name)
Sets the column name of this variable. This should be used if the variable is resolved from one form to another.


setTableName

public void setTableName(TableName tname)
Sets the TableName of this variable.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Performs a deep clone of this object.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
To string.

Overrides:
toString in class java.lang.Object

toTechString

public java.lang.String toTechString()
To a differently formatted string.


equals

public boolean equals(java.lang.Object ob)
Equality.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object ob)
Comparable.


hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class java.lang.Object