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 this column name.Returns this column data type.Returnstrueif this column is nullable.Returns this column sql data type name.booleaninthashCode()booleanstatic 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. -
Column
Creates a Column object. -
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() -
isNotNullable
public boolean isNotNullable() -
getColumnName
Returns this column name. -
getDataType
Returns this column data type. -
getSqlTypeName
Returns this column sql data type name. -
getNullable
Returnstrueif this column is nullable. -
getDefaultValue
- 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
- Since:
- 2.4.3
-
getAutoIncrement
- Returns:
- The auto-increment property for this column
- Since:
- 2.4.3
-
getGeneratedColumn
- 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
-
nullableValue
Returns the appropriate Nullable constant.- Parameters:
nullable-trueif null is allowed
-
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()
-