com.googlecode.jdbw.metadata
Class Column

java.lang.Object
  extended by com.googlecode.jdbw.metadata.Column
All Implemented Interfaces:
Comparable<Column>

public class Column
extends Object
implements Comparable<Column>

A column is a part of a database table, holding a specific value for every row in the table. The column will have a determined type and depending on the type could also have additional data associated with it, such as maximum string length or decimal precision. A column is also either nullable (can have the null value, representing the absence of a value) or not nullable (trying to assign null will give an error).

Normally you don't construct Column objects yourself, rather you get them by using methods on other objects that holds columns.

Author:
Martin Berglund
See Also:
Table, Index

Constructor Summary
Column(int ordinalPosition, String columnName, int sqlType, String typeName, int columnSize, int decimalDigits, int nullable, String autoIncrement, Table table)
           
 
Method Summary
 int compareTo(Column o)
           
 boolean equals(Object obj)
           
 String getAutoIncrement()
           
 int getColumnSize()
           
 int getDecimalDigits()
           
 String getName()
           
 String getNativeTypeName()
           
 Nullability getNullable()
           
 Integer getOrdinalPosition()
           
 int getSqlType()
          Returns the datatype of this column, expressed as an integer which matches a constant in java.sql.Types.
 Table getTable()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Column

public Column(int ordinalPosition,
              String columnName,
              int sqlType,
              String typeName,
              int columnSize,
              int decimalDigits,
              int nullable,
              String autoIncrement,
              Table table)
Method Detail

getAutoIncrement

public String getAutoIncrement()
Returns:
The JDBC value of IS_AUTOINCREMENT for this column

getName

public String getName()
Returns:
Name of the column

getColumnSize

public int getColumnSize()
Returns:
The max size of the column, for string type columns, or the max total number of digits for decimal types. For all other types, this is undefined.

getDecimalDigits

public int getDecimalDigits()
Returns:
For decimal or numeric columns, the max number of fractional digits, for all other types undefined

getNullable

public Nullability getNullable()
Returns:
Nullability of this column

getOrdinalPosition

public Integer getOrdinalPosition()
Returns:
Index of this column in its table, where the first column has index 1

getSqlType

public int getSqlType()
Returns the datatype of this column, expressed as an integer which matches a constant in java.sql.Types.

Returns:
Datatype of the column, matching a JDBC constant in java.sql.Types.
See Also:
Types

getNativeTypeName

public String getNativeTypeName()
Returns:
The native name of the data type for this column, as the server presents it to the JDBC driver

getTable

public Table getTable()
Returns:
Table owning this column

compareTo

public int compareTo(Column o)
Specified by:
compareTo in interface Comparable<Column>

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.