org.eobjects.metamodel.util
Class SimpleTableDef

java.lang.Object
  extended by org.eobjects.metamodel.util.SimpleTableDef
All Implemented Interfaces:
Serializable, HasName

public class SimpleTableDef
extends Object
implements Serializable, HasName

Represents a table definition to be used in scenarios where a DataContext is unable to detect/discover the table structure and needs some basic input around expected table structures.

Author:
Kasper Sørensen
See Also:
Serialized Form

Constructor Summary
SimpleTableDef(String name, String[] columnNames)
          Constructs a SimpleTableDef.
SimpleTableDef(String name, String[] columnNames, ColumnType[] columnTypes)
          Constructs a SimpleTableDef.
SimpleTableDef(Table table)
          Constructs a SimpleTableDef using a Table as a prototype.
 
Method Summary
 boolean equals(Object obj)
           
 String[] getColumnNames()
          Gets the names of the columns in the table
 ColumnType[] getColumnTypes()
          Gets the types of the columns in the table
 String getName()
          Gets the name of the table
 int hashCode()
           
 int indexOf(String columnName)
          Gets the index of a column name, or -1 if the column name does not exist
 String toString()
           
 MutableTable toTable()
          Creates a MutableTable based on this SimpleTableDef.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTableDef

public SimpleTableDef(Table table)
Constructs a SimpleTableDef using a Table as a prototype.

Parameters:
table -

SimpleTableDef

public SimpleTableDef(String name,
                      String[] columnNames)
Constructs a SimpleTableDef.

Parameters:
name - the name of the table
columnNames - the names of the columns to include in the table

SimpleTableDef

public SimpleTableDef(String name,
                      String[] columnNames,
                      ColumnType[] columnTypes)
Constructs a SimpleTableDef.

Parameters:
name - the name of table
columnNames - the names of the columns to include in the table
columnTypes - the column types of the columns specified.
Method Detail

getName

public String getName()
Gets the name of the table

Specified by:
getName in interface HasName
Returns:
the name of the table

getColumnNames

public String[] getColumnNames()
Gets the names of the columns in the table

Returns:
the names of the columns in the table

getColumnTypes

public ColumnType[] getColumnTypes()
Gets the types of the columns in the table

Returns:
the types of the columns in the table

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

toTable

public MutableTable toTable()
Creates a MutableTable based on this SimpleTableDef. Note that the created table will not have any schema set.

Returns:
a table representation of this table definition.

indexOf

public int indexOf(String columnName)
Gets the index of a column name, or -1 if the column name does not exist

Parameters:
columnName -
Returns:


Copyright © 2007-2013. All Rights Reserved.