org.omus.data
Class TableDefinition

java.lang.Object
  |
  +--org.omus.data.TableDefinition
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

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

TableDefinition objects are used to define the names and datatypes of the columns of a DataTable object.

See Also:
Serialized Form

Constructor Summary
TableDefinition()
           
 
Method Summary
 void addColumn(java.lang.String name, java.lang.Class type)
          Adds a new column to this table definition.
 java.lang.Object clone()
          Returns a clone of this table definition.
 boolean equals(java.lang.Object o)
          Returns true if the specified object is a table definition with the same sequence of columns.
 int getColumnCount()
          Returns the number of columns in this table definition.
 java.lang.String getColumnName(int idx)
          Returns the name of the column at the specified index position.
 java.lang.String[] getColumnNames()
          Returns an array of all column names in the order they were added to this TableDefinition.
 java.lang.Class getColumnType(int idx)
          Returns the type of the column at the specified index position.
 boolean matches(DataRow dr)
          Returns true if the specified DataRow matches this table definition.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableDefinition

public TableDefinition()
Method Detail

addColumn

public void addColumn(java.lang.String name,
                      java.lang.Class type)
Adds a new column to this table definition. This method will fail if this TableDefinition object was already used to construct a new DataTable object, since it is unmodifiable after that. The second argument must be one of the 10 subclasses of DataField.

getColumnCount

public int getColumnCount()
Returns the number of columns in this table definition.

getColumnName

public java.lang.String getColumnName(int idx)
Returns the name of the column at the specified index position.

getColumnType

public java.lang.Class getColumnType(int idx)
Returns the type of the column at the specified index position.

getColumnNames

public java.lang.String[] getColumnNames()
Returns an array of all column names in the order they were added to this TableDefinition.

matches

public boolean matches(DataRow dr)
Returns true if the specified DataRow matches this table definition. The number of DataFields contained in the specified DataRow must match the number of columns in this definition object and each DataField of the specified DataRow must have a matching name and datatype in this definition object.

equals

public boolean equals(java.lang.Object o)
Returns true if the specified object is a table definition with the same sequence of columns.
Overrides:
equals in class java.lang.Object

toString

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

clone

public java.lang.Object clone()
Returns a clone of this table definition.