org.brains2b.sql.meta
Class ColumnModel

java.lang.Object
  extended by org.brains2b.sql.meta.ColumnModel
All Implemented Interfaces:
SQLMetaModel

public class ColumnModel
extends java.lang.Object
implements SQLMetaModel

Wrapper around column definition from DatabaseMetaData

Class is read-only, use SquelerDDL:ColumnDDL for changing columns

Version:
1.01 [26-10-2007]
Author:
dennis@brains2b.nl
See Also:
SQLMetaData, SQLRecord

Constructor Summary
protected ColumnModel()
          Constructor only used by ColumnDDL
  ColumnModel(SQLRecord record)
          Create a ColumnModel on the basis of this SQLRecord
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getColumnSize()
          get the size of the column for non-numeric types or the precision for numeric types
 int getDataType()
          get the datatype as defined in java.sql.Type
 int getDecimalDigits()
          get the number of decimal places for a numeric field.
 java.lang.String getDefault()
          get the column default value
 java.lang.String getName()
          get the name for this model's instance
 SQLRecord getRecord()
          the record which defines all the values for the model
 java.lang.String getRemarks()
          get optional remarks for a column
 int getSequence()
          get the sequence of this column within the object it is contained in such as a TableModel, IndexModel or ConstraintModel
 java.lang.String getTableName()
          get the table name
 java.lang.String getType()
          get the type of Object defined by the meta model
 java.lang.String getTypeName()
          get the type description for the column type
 boolean isNullable()
          get an indication if the field is nullable
protected  void setRecord(SQLRecord record)
          set the record for this Model
 java.lang.String toString()
          a String representation of this column as tablename.name
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnModel

protected ColumnModel()
Constructor only used by ColumnDDL


ColumnModel

public ColumnModel(SQLRecord record)
Create a ColumnModel on the basis of this SQLRecord

Parameters:
record - SQLRecord, the record containing the information on this column
Method Detail

getName

public java.lang.String getName()
get the name for this model's instance

This is equal to the name of the table,column, etc.

Specified by:
getName in interface SQLMetaModel
Returns:
String

getRecord

public SQLRecord getRecord()
the record which defines all the values for the model

Specified by:
getRecord in interface SQLMetaModel
Returns:
SQLRecord

getType

public java.lang.String getType()
get the type of Object defined by the meta model

returned value depends on the model: TABLE,COLUMN,INDEX

Specified by:
getType in interface SQLMetaModel
Returns:
String

getSequence

public int getSequence()
get the sequence of this column within the object it is contained in such as a TableModel, IndexModel or ConstraintModel

Returns:
int, a number starting at 1 (not 0) of the position of this column as part of another object

getTableName

public java.lang.String getTableName()
get the table name

Returns:
String, the name of the table

getDataType

public int getDataType()
get the datatype as defined in java.sql.Type

Returns:
int, the type of the data in this column

getTypeName

public java.lang.String getTypeName()
get the type description for the column type

This value is specific for the database used

Returns:
String, the type description

getColumnSize

public int getColumnSize()
get the size of the column for non-numeric types or the precision for numeric types

Returns:
int, the size or precision for this column

getDecimalDigits

public int getDecimalDigits()
get the number of decimal places for a numeric field.

Returns:
int, the number of decimal places

isNullable

public boolean isNullable()
get an indication if the field is nullable

Returns:
String, indicator if the column can be nullable

getRemarks

public java.lang.String getRemarks()
get optional remarks for a column

Returns:
String, the remarks for this column

getDefault

public java.lang.String getDefault()
get the column default value

Returns:
String, a description of the column definition

toString

public java.lang.String toString()
a String representation of this column as tablename.name

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

setRecord

protected void setRecord(SQLRecord record)
set the record for this Model

Parameters:
record - SQLRecord

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object