cmu.survey.data
Class TableFormat.TableFormatStub
java.lang.Object
cmu.survey.data.TableFormat.TableFormatStub
- All Implemented Interfaces:
- TableFormat
- Direct Known Subclasses:
- DataBitStorageTable.AuxillaryOptionTableFormatClass, DataBitStorageTable.QuestionsTableFormatClass, DataBitStorageTable.RepeatedMeasureAnswerTableFormatClass, DataBitStorageTable.RepeatedMeasureTableFormatClass, DataBitStorageTable.SurveyPagesTableFormatClass, TableFormat.TableFormatStubAndDoMoreAddRow
- Enclosing interface:
- TableFormat
public static class TableFormat.TableFormatStub
- extends java.lang.Object
- implements TableFormat
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TableFormat.TableFormatStub
public TableFormat.TableFormatStub(java.lang.String tableName)
TableFormat.TableFormatStub
public TableFormat.TableFormatStub(java.lang.String tableName,
TableFormat.ColumnFormat[] columns)
TableFormat.TableFormatStub
public TableFormat.TableFormatStub(java.lang.String tableName,
TableFormat.ColumnFormat[] columns,
int primaryKeyColumnIndex)
TableFormat.TableFormatStub
public TableFormat.TableFormatStub(java.lang.String tableName,
TableFormat.ColumnFormat[] columns,
int primaryKeyColumnIndex,
int version)
TableFormat.TableFormatStub
public TableFormat.TableFormatStub(java.lang.String tableName,
java.util.List<TableFormat.ColumnFormat> columns)
getColumns
public java.util.List<TableFormat.ColumnFormat> getColumns()
- Specified by:
getColumns
in interface TableFormat
- Returns:
- List of ColumnFormat
getColumn
public TableFormat.ColumnFormat getColumn(java.lang.String name)
- Description copied from interface:
TableFormat
- Get a column by this name, if it exists. If it doesn't exist, return null.
- Specified by:
getColumn
in interface TableFormat
- Returns:
getName
public java.lang.String getName()
- Specified by:
getName
in interface TableFormat
getPrimaryKeyColumnIndex
public int getPrimaryKeyColumnIndex()
- Description copied from interface:
TableFormat
- The index of the column that is the primary key. This is optional, and it can be -1 if there's no primary key. However, in order to use the full functionality of TableFormat and of auto-updating columns, there must be a primary key.
Basically, the primary key is needed after a new column is created or renamed, so that any queries on the database that are currently happening can be automatically re-done and reset to their previous location.
Primary keys must be integers. When a new row is created, an unused integer will be set as the value of the primary key. (In MySQL, they are AUTO_INCREMENT columns).
- Specified by:
getPrimaryKeyColumnIndex
in interface TableFormat
- Returns:
- if no primary key returns -1, if there is a primary key it's the index in getColumns() of the column that's the primary key
getDefaultData
public java.util.List getDefaultData()
- Description copied from interface:
TableFormat
- The default data to initialize this table with, if it is initialized. If there is no default data for this table, return null.
- Specified by:
getDefaultData
in interface TableFormat
- Returns:
getVersion
public int getVersion()
- Description copied from interface:
TableFormat
- The version of the table. Increment this every time you make a new version of the table. This way, when an upgrade is needed, it will check to make sure that it's upgrading -- for example, if you upgrade, and then run an old version of the program, it might do reverse of the changes, or create an old column that shouldn't be there, etc., without realizing that it's not compatible with this version.
- Specified by:
getVersion
in interface TableFormat
- Returns:
setColumns
public void setColumns(java.util.List<TableFormat.ColumnFormat> columns)
- Parameters:
columns
- The columns to set.
setDefaultData
public void setDefaultData(java.util.List<? extends java.lang.Object> defaultData)
- Parameters:
defaultData
- The defaultData to set.
setPrimaryKeyColumnIndex
public void setPrimaryKeyColumnIndex(int primaryKeyColumn)
- Parameters:
primaryKeyColumn
- The primaryKeyColumn to set.
setName
public void setName(java.lang.String tableName)
- Parameters:
tableName
- The tableName to set.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object