com.mckoi.database
Class TableName

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

public final class TableName
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A name of a table and any associated referencing information. This object is immutable.

Author:
Tobias Downer
See Also:
Serialized Form

Constructor Summary
TableName(java.lang.String table_name)
           
TableName(java.lang.String schema_name, java.lang.String table_name)
          Constructs the name.
 
Method Summary
 int compareTo(java.lang.Object ob)
          Comparable.
 boolean equals(java.lang.Object ob)
          Equality.
 boolean equalsIgnoreCase(TableName tn)
          Equality but ignore the case.
 java.lang.String getName()
          Returns the table name.
 java.lang.String getSchema()
          Returns the schema name or null if the schema name is unknown.
 int hashCode()
          Hash code.
static TableName resolve(java.lang.String namev)
          Resolves a [schema name].[table name] type syntax to a TableName object.
static TableName resolve(java.lang.String schemav, java.lang.String namev)
          Resolves a [schema name].[table name] type syntax to a TableName object.
 TableName resolveSchema(java.lang.String scheman)
          Resolves a schema reference in a table name.
 java.lang.String toString()
          To string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableName

public TableName(java.lang.String schema_name,
                 java.lang.String table_name)
Constructs the name.


TableName

public TableName(java.lang.String table_name)
Method Detail

getSchema

public java.lang.String getSchema()
Returns the schema name or null if the schema name is unknown.


getName

public java.lang.String getName()
Returns the table name.


resolveSchema

public TableName resolveSchema(java.lang.String scheman)
Resolves a schema reference in a table name. If the schema in this table is 'null' (which means the schema is unknown) then it is set to the given schema argument.


resolve

public static TableName resolve(java.lang.String schemav,
                                java.lang.String namev)
Resolves a [schema name].[table name] type syntax to a TableName object. Uses 'schemav' only if there is no schema name explicitely specified.


resolve

public static TableName resolve(java.lang.String namev)
Resolves a [schema name].[table name] type syntax to a TableName object.


toString

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

Overrides:
toString in class java.lang.Object

equals

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

Overrides:
equals in class java.lang.Object

equalsIgnoreCase

public boolean equalsIgnoreCase(TableName tn)
Equality but ignore the case.


compareTo

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

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class java.lang.Object