com.triactive.jdo.store.sql
Class Column
java.lang.Object
com.triactive.jdo.store.sql.Column
- All Implemented Interfaces:
- java.lang.Comparable
- public class Column
- extends java.lang.Object
- implements java.lang.Comparable
A column in a database table.
Column objects are used primarily for generating the DDL for a CREATE TABLE
statement or for validating against an existing column in the database.
Columns are used as backing by the various Mapping
objects.
Most columns are mapped 1:1 by a single ColumnMapping
object.
The column attributes, including SQL type, are usually set by the Mapping.
- Author:
- Mike Martin
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
LENGTH_NOT_SET
public static final int LENGTH_NOT_SET
- See Also:
- Constant Field Values
FIXED_LENGTH
public static final int FIXED_LENGTH
- See Also:
- Constant Field Values
MAXIMUM_LENGTH
public static final int MAXIMUM_LENGTH
- See Also:
- Constant Field Values
UNLIMITED_LENGTH
public static final int UNLIMITED_LENGTH
- See Also:
- Constant Field Values
Column
public Column(Table table,
ColumnName name)
getTable
public Table getTable()
getName
public ColumnName getName()
getMapping
public ColumnMapping getMapping()
mapWith
public void mapWith(ColumnMapping mapping)
getSqlDefinition
public java.lang.String getSqlDefinition()
- Returns a SQL DDL string defining this column as would be included in a
CREATE TABLE statement.
- Returns:
- The SQL DDL defining this column.
validate
public void validate(ColumnInfo ci)
- Asserts that an existing database column matches, or is effectively
compatible with, the column described by this Column object.
- Parameters:
ci
- Metadata on the existing column obtained from JDBC.
- Throws:
SchemaValidationException
- If the existing column is not compatible with this Column object.
setOptions
public Column setOptions(ColumnOptions co)
setTypeInfo
public final Column setTypeInfo(TypeInfo typeInfo)
setConstraints
public final Column setConstraints(java.lang.String constraints)
setFixedLength
public final Column setFixedLength(int length)
setMaximumLength
public final Column setMaximumLength(int length)
setUnlimitedLength
public final Column setUnlimitedLength()
setExactPrecision
public final Column setExactPrecision(int precision)
setMinimumPrecision
public final Column setMinimumPrecision(int precision)
setScale
public final Column setScale(short scale)
setNullable
public final Column setNullable(boolean nullable)
setUnique
public final Column setUnique(boolean unique)
getTypeInfo
public final TypeInfo getTypeInfo()
getPrecision
public final int getPrecision()
getScale
public final short getScale()
getLengthType
public int getLengthType()
isExactPrecision
public final boolean isExactPrecision()
isNullable
public final boolean isNullable()
isUnique
public final boolean isUnique()
checkPrimitive
public final void checkPrimitive()
throws ColumnDefinitionException
- Throws:
ColumnDefinitionException
checkInteger
public final void checkInteger()
throws ColumnDefinitionException
- Throws:
ColumnDefinitionException
checkDecimal
public final void checkDecimal()
throws ColumnDefinitionException
- Throws:
ColumnDefinitionException
checkString
public final void checkString()
throws ColumnDefinitionException
- Throws:
ColumnDefinitionException
hashCode
public int hashCode()
equals
public boolean equals(java.lang.Object obj)
compareTo
public int compareTo(java.lang.Object obj)
- Compares this object with the specified object for order.
Returns a negative integer, zero, or a positive integer as this object is
less than, equal to, or greater than the specified object.
Columns are ordered by their
name
.
- Specified by:
compareTo
in interface java.lang.Comparable
- Parameters:
obj
- the Object to be compared.
- Returns:
- a negative integer, zero, or a positive integer as this object is
less than, equal to, or greater than the specified object.
toString
public java.lang.String toString()
Copyright © 2001-2007 The TJDO Project All Rights Reserved.