|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.database.util.Schema
public class Schema
The Schema
encapsulates all the information concerning a database table schema.
Field Summary | |
---|---|
protected List<ColumnInfo> |
columns
A list of all column representations which are part of this schema. |
Constructor Summary | |
---|---|
Schema(Collection<ColumnInfo> cols)
Initializes a Schema using a given collection of ColumnInfo instances. |
|
Schema(Connection conn,
String sqlSchema,
String tableName)
Initializes the Schema out of the passed table. |
Method Summary | |
---|---|
protected boolean |
columnNamesAreUnique()
Checks whether the set columns are unique. |
protected ColumnInfo |
getColumnInfo(int index)
Returns the information of the column with the given index. |
String |
getColumnName(int columnIndex)
Returns the name of the specified column. |
int |
getColumnSQLType(int columnIndex)
Returns the data type of the specified column. |
boolean |
isEmpty()
Checks whether the current schema contains no columns. |
Iterator<ColumnInfo> |
iterator()
Returns an iterator that iterates over the Schema instance. |
int |
size()
Returns the schema's column count. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List<ColumnInfo> columns
Constructor Detail |
---|
public Schema(Collection<ColumnInfo> cols) throws InvalidSchemaException
Schema
using a given collection of ColumnInfo
instances.
cols
- A collection of ColumnInfo
instances representing all columns of this Schema
.
InvalidSchemaException
- If the column names are not unique.public Schema(Connection conn, String sqlSchema, String tableName) throws InvalidSchemaException
Schema
out of the passed table.
conn
- The connection to the table's database.sqlSchema
- The SQL schema of the table.tableName
- The name of the table.
InvalidSchemaException
- If an error occurred while extracting the Schema
information.Method Detail |
---|
protected boolean columnNamesAreUnique()
true
, if each column has a unique name; otherwise false
.public int size()
protected ColumnInfo getColumnInfo(int index)
index
- The position of the column in the schema.
ColumnInfo
of the column located at position index
in the schema.public int getColumnSQLType(int columnIndex)
columnIndex
- The position of the column.
Types
public String getColumnName(int columnIndex)
columnIndex
- The position of the column.
public Iterator<ColumnInfo> iterator()
Schema
instance.
iterator
in interface Iterable<ColumnInfo>
Iterable.iterator()
public boolean isEmpty()
true
, if no columns are part of this schema; otherwise false
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |