org.dbunit.dataset
Class Column

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

public class Column
extends Object

Represents a table column.

Since:
Feb 17, 2002
Version:
$Revision: 873 $ $Date: 2008-11-09 12:18:27 +0100 (Sun, 09 Nov 2008) $
Author:
Manuel Laflamme, Last changed by: $Author: gommma $

Nested Class Summary
static class Column.Nullable
          Specifies nullable usage.
 
Field Summary
static Column.Nullable NO_NULLS
          Indicates that the column might not allow NULL values.
static Column.Nullable NULLABLE
          Indicates that the column definitely allows NULL values.
static Column.Nullable NULLABLE_UNKNOWN
          Indicates that the nullability of columns is unknown.
 
Constructor Summary
Column(String columnName, DataType dataType)
          Creates a Column object.
Column(String columnName, DataType dataType, Column.Nullable nullable)
          Creates 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.
 
Method Summary
 boolean equals(Object o)
           
 String getColumnName()
          Returns this column name.
 DataType getDataType()
          Returns this column data type.
 String getDefaultValue()
           
 Column.Nullable getNullable()
          Returns true if this column is nullable.
 String getSqlTypeName()
          Returns this column sql data type name.
 int hashCode()
           
static Column.Nullable nullableValue(boolean nullable)
          Returns the appropriate Nullable constant.
static Column.Nullable nullableValue(int nullable)
          Returns the appropriate Nullable constant according specified JDBC DatabaseMetaData constant.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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 Detail

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.
Method Detail

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

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

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


Copyright © 2002-2012. All Rights Reserved.