Package org.dbunit.dataset
Class Column
java.lang.Object
org.dbunit.dataset.Column
Represents a table column.
- Since:
- 1.0 (Feb 17, 2002)
- Version:
- $Revision$ $Date$
- Author:
- Manuel Laflamme, Last changed by: $Author$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEnumeration for valid auto-increment values provided by JDBC driver implementations.static classSpecifies nullable usage. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Column.NullableIndicates that the column might not allowNULLvalues.static final Column.NullableIndicates that the column definitely allowsNULLvalues.static final Column.NullableIndicates that the nullability of columns is unknown. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a Column object.Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable) Creates a Column object.Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue) Creates a Column object.Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue, String remarks, Column.AutoIncrement autoIncrement) Creates a Column object.Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue, String remarks, Column.AutoIncrement autoIncrement, Boolean generatedColumn) Creates a Column object.Column(String columnName, DataType dataType, Column.Nullable nullable) Creates a Column object. -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanconvertMetaDataBoolean(String value) Converts a DatabaseMetaData boolean string to a Boolean object.booleanReturns the auto-increment property for this column.Returns this column name.Returns this column data type.Returns the default value the database uses for this column.Returns whether the column is a generated column.Returnstrueif this column is nullable.Returns the remarks set on the database for this column.Returns this column sql data type name.booleanReturns whether the database has a default value configured for this column.inthashCode()booleanReturns whether this column definitely does not allowNULLvalues.static Column.NullablenullableValue(boolean nullable) Returns the appropriate Nullable constant.static Column.NullablenullableValue(int nullable) Returns the appropriate Nullable constant according specified JDBC DatabaseMetaData constant.toString()
-
Field Details
-
NO_NULLS
Indicates that the column might not allowNULLvalues. -
NULLABLE
Indicates that the column definitely allowsNULLvalues. -
NULLABLE_UNKNOWN
Indicates that the nullability of columns is unknown.
-
-
Constructor Details
-
Column
Creates a Column object. This constructor set nullable to true.- Parameters:
columnName- the column namedataType- the data type
-
Column
Creates a Column object.- Parameters:
columnName- the column name.dataType- the data type.nullable- whether or not the column is nullable.
-
Column
Creates a Column object.- Parameters:
columnName- the column name.dataType- the data type.sqlTypeName- the SQL name of the column which comes from the JDBC driver.nullable- whether or not the column is nullable.
-
Column
public Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue) Creates a Column object.- Parameters:
columnName- The name of the columndataType- The DbUnitDataTypeof the columnsqlTypeName- The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' inDatabaseMetaData.getColumns(String, String, String, String)nullable- whether or not the column is nullabledefaultValue- The default value on the DB for this column. Can benull.
-
Column
public Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue, String remarks, Column.AutoIncrement autoIncrement) Creates a Column object.- Parameters:
columnName- The name of the columndataType- The DbUnitDataTypeof the columnsqlTypeName- The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' inDatabaseMetaData.getColumns(String, String, String, String)nullable- whether or not the column is nullabledefaultValue- The default value on the DB for this column. Can benull.remarks- The remarks on the DB for this column. Can benull.autoIncrement- The auto increment setting for this column. Can benull.
-
Column
public Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable, String defaultValue, String remarks, Column.AutoIncrement autoIncrement, Boolean generatedColumn) Creates a Column object.- Parameters:
columnName- The name of the columndataType- The DbUnitDataTypeof the columnsqlTypeName- The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' inDatabaseMetaData.getColumns(String, String, String, String)nullable- whether or not the column is nullabledefaultValue- The default value on the DB for this column. Can benull.remarks- The remarks on the DB for this column. Can benull.autoIncrement- The auto increment setting for this column. Can benull.generatedColumn- Whether this column is a generated column. Can benull.
-
-
Method Details
-
hasDefaultValue
public boolean hasDefaultValue()Returns whether the database has a default value configured for this column.- Returns:
trueif this column has a default value.
-
isNotNullable
public boolean isNotNullable()Returns whether this column definitely does not allowNULLvalues.- Returns:
trueif this column is not nullable.
-
getColumnName
Returns this column name.- Returns:
- this column name.
-
getDataType
Returns this column data type.- Returns:
- this column data type.
-
getSqlTypeName
Returns this column sql data type name.- Returns:
- this column sql data type name.
-
getNullable
Returnstrueif this column is nullable.- Returns:
- this column's nullability.
-
getDefaultValue
Returns the default value the database uses for this column.- Returns:
- The default value the database uses for this column if not specified in the insert column list
-
getRemarks
Returns the remarks set on the database for this column.- Returns:
- The remarks set on the database for this column
- Since:
- 2.4.3
-
getAutoIncrement
Returns the auto-increment property for this column.- Returns:
- The auto-increment property for this column
- Since:
- 2.4.3
-
getGeneratedColumn
Returns whether the column is a generated column.- Returns:
- Whether the column is a generated column
- Since:
- 3.0.0
-
nullableValue
Returns the appropriate Nullable constant according specified JDBC DatabaseMetaData constant.- Parameters:
nullable- one of the following constantsDatabaseMetaData.columnNoNulls,DatabaseMetaData.columnNullable,DatabaseMetaData.columnNullableUnknown- Returns:
- the corresponding Nullable constant.
-
nullableValue
Returns the appropriate Nullable constant.- Parameters:
nullable-trueif null is allowed- Returns:
- the corresponding Nullable constant.
-
convertMetaDataBoolean
Converts a DatabaseMetaData boolean string to a Boolean object.- Parameters:
value- The string to convert- Returns:
- True if string is "YES", false if string is "NO", null otherwise
-
toString
-
equals
-
hashCode
public int hashCode()
-