Class Column

java.lang.Object
org.dbunit.dataset.Column

public class Column extends Object
Represents a table column.
Since:
1.0 (Feb 17, 2002)
Version:
$Revision$ $Date$
Author:
Manuel Laflamme, Last changed by: $Author$
  • Field Details

    • NO_NULLS

      public static final Column.Nullable NO_NULLS
      Indicates that the column might not allow NULL values.
    • NULLABLE

      public static final Column.Nullable NULLABLE
      Indicates that the column definitely allows NULL values.
    • NULLABLE_UNKNOWN

      public static final Column.Nullable NULLABLE_UNKNOWN
      Indicates that the nullability of columns is unknown.
  • Constructor Details

    • Column

      public Column(String columnName, DataType dataType)
      Creates a Column object. This constructor set nullable to true.
      Parameters:
      columnName - the column name
      dataType - the data type
    • Column

      public Column(String columnName, DataType dataType, Column.Nullable nullable)
      Creates a Column object.
    • Column

      public Column(String columnName, DataType dataType, String sqlTypeName, Column.Nullable nullable)
      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 column
      dataType - The DbUnit DataType of the column
      sqlTypeName - The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' in DatabaseMetaData.getColumns(String, String, String, String)
      nullable - whether or not the column is nullable
      defaultValue - The default value on the DB for this column. Can be null.
    • 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 column
      dataType - The DbUnit DataType of the column
      sqlTypeName - The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' in DatabaseMetaData.getColumns(String, String, String, String)
      nullable - whether or not the column is nullable
      defaultValue - The default value on the DB for this column. Can be null.
      remarks - The remarks on the DB for this column. Can be null.
      autoIncrement - The auto increment setting for this column. Can be null.
    • 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 column
      dataType - The DbUnit DataType of the column
      sqlTypeName - The SQL name of the column which comes from the JDBC driver. See value 'TYPE_NAME' in DatabaseMetaData.getColumns(String, String, String, String)
      nullable - whether or not the column is nullable
      defaultValue - The default value on the DB for this column. Can be null.
      remarks - The remarks on the DB for this column. Can be null.
      autoIncrement - The auto increment setting for this column. Can be null.
      generatedColumn - Whether this column is a generated column. Can be null.
  • Method Details

    • hasDefaultValue

      public boolean hasDefaultValue()
    • isNotNullable

      public boolean isNotNullable()
    • getColumnName

      public String getColumnName()
      Returns this column name.
    • getDataType

      public DataType getDataType()
      Returns this column data type.
    • getSqlTypeName

      public String getSqlTypeName()
      Returns this column sql data type name.
    • getNullable

      public Column.Nullable getNullable()
      Returns true if this column is nullable.
    • getDefaultValue

      public String getDefaultValue()
      Returns:
      The default value the database uses for this column if not specified in the insert column list
    • getRemarks

      public String getRemarks()
      Returns:
      The remarks set on the database for this column
      Since:
      2.4.3
    • getAutoIncrement

      public Column.AutoIncrement getAutoIncrement()
      Returns:
      The auto-increment property for this column
      Since:
      2.4.3
    • getGeneratedColumn

      public Boolean getGeneratedColumn()
      Returns:
      Whether the column is a generated column
      Since:
      3.0.0
    • nullableValue

      public static Column.Nullable nullableValue(int nullable)
      Returns the appropriate Nullable constant according specified JDBC DatabaseMetaData constant.
      Parameters:
      nullable - one of the following constants DatabaseMetaData.columnNoNulls, DatabaseMetaData.columnNullable, DatabaseMetaData.columnNullableUnknown
    • nullableValue

      public static Column.Nullable nullableValue(boolean nullable)
      Returns the appropriate Nullable constant.
      Parameters:
      nullable - true if null is allowed
    • convertMetaDataBoolean

      public static Boolean convertMetaDataBoolean(String value)
      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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object