2004.04.29


com.jdc.rdb
Class Column

java.lang.Object
  |
  +--com.jdc.lang.Object
        |
        +--com.jdc.lang.SerializableObject
              |
              +--com.jdc.rdb.Column
All Implemented Interfaces:
Column, Serializable
Direct Known Subclasses:
DateColumn, DecimalColumn, IntegerColumn, TableColumn, TextColumn, TimestampColumn

public abstract class Column
extends SerializableObject
implements Column

A default implementation of com.jdc.rdb.tbl.Column. All application database table column classes should subclass this database table Column class or one of its subclasses, including:

A database table Column is defined by its attributes. The following are attributes of database table columns: To define a database table column, extend this class and invoke one of the constructors provided.

Note: This class is immutable.

Version:
1.0
Author:
Jay Damon
See Also:
Table, Serialized Form

Field Summary
static boolean ALLOW_NULL
          Denotes that the database table column may contain a null value.
static boolean NOT_NULL
          Denotes that the database table column may not contain a null value.
 
Fields inherited from class com.jdc.lang.Object
string
 
Fields inherited from interface com.jdc.db.Column
NULL
 
Constructor Summary
protected Column(DataType type, String name, String alias, boolean allowNull)
          Constructs a new database table Column object for the specified column type, name, alias, and allow null status.
protected Column(DataType type, String name, String alias, int length, boolean allowNull)
          Constructs a new database table Column object for the specified column type, name, alias, length, and allow null status.
protected Column(DataType type, String name, String alias, int precision, int scale, boolean allowNull)
          Constructs a new database table Column object for the specified column type, name, alias, precision, scale, and allow null status.
 
Method Summary
 boolean equals(Object object)
          Compares this Column object to the specified object.
 String getAlias()
          Returns the database table column alias.
 int getLength()
          Returns the database table column length for character table columns.
 String getName()
          Returns the database table column name.
 int getPrecision()
          Returns the database table column precision for numeric table columns.
 int getScale()
          Returns the database table column scale for numeric table columns.
 DataType getType()
          Returns the database table column data type.
 boolean isAllowNull()
          Returns true if the database table column allows a null value.
 String toString()
          Returns a String representing this Column object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jdc.db.Column
newInstance
 

Field Detail

ALLOW_NULL

public static final boolean ALLOW_NULL
Denotes that the database table column may contain a null value.

See Also:
Constant Field Values

NOT_NULL

public static final boolean NOT_NULL
Denotes that the database table column may not contain a null value.

See Also:
Constant Field Values
Constructor Detail

Column

protected Column(DataType type,
                 String name,
                 String alias,
                 int length,
                 boolean allowNull)
Constructs a new database table Column object for the specified column type, name, alias, length, and allow null status.

The specified text column length determines the database table column type. If the column length is less than 16 characters, the database table column type will be DataType.CHAR. Otherwise, the database table column type will be DataType.VARCHAR


Column

protected Column(DataType type,
                 String name,
                 String alias,
                 int precision,
                 int scale,
                 boolean allowNull)
Constructs a new database table Column object for the specified column type, name, alias, precision, scale, and allow null status.


Column

protected Column(DataType type,
                 String name,
                 String alias,
                 boolean allowNull)
Constructs a new database table Column object for the specified column type, name, alias, and allow null status.

Although this constructor is valid for any DataType, it is provided primarily in order to create the following Column types:

Method Detail

equals

public boolean equals(Object object)
Compares this Column object to the specified object. Returns true if the name and alias for the specified Column is equal to the name and alias for this Column.

Overrides:
equals in class Object
Returns:
True if a specified object is equal to this Column object.
False if the specified object is not equal to this Column object

getAlias

public String getAlias()
Returns the database table column alias. If an alias is not specified, this method generates a column alias from the database table column name.

Specified by:
getAlias in interface Column
Returns:
The database table column alias.

getLength

public int getLength()
Returns the database table column length for character table columns. If this column is numeric, the length is the same as the precision.

Specified by:
getLength in interface Column
Returns:
The database table column length.

getName

public String getName()
Description copied from interface: Column
Returns the database table column name.

Specified by:
getName in interface Column
Returns:
The database table column name.

getPrecision

public int getPrecision()
Description copied from interface: Column
Returns the database table column precision for numeric table columns.

Specified by:
getPrecision in interface Column
Returns:
The database table column precision.

getScale

public int getScale()
Description copied from interface: Column
Returns the database table column scale for numeric table columns.

Specified by:
getScale in interface Column
Returns:
The database table column scale.

getType

public DataType getType()
Description copied from interface: Column
Returns the database table column data type.

Specified by:
getType in interface Column
Returns:
The database table column data type.

isAllowNull

public boolean isAllowNull()
Returns true if the database table column allows a null value.

Specified by:
isAllowNull in interface Column
Returns:
True if the database table column allows a null values.
False if the database table column does not allow a null value.

toString

public String toString()
Returns a String representing this Column object.

Overrides:
toString in class Object
Returns:
A String representing this Column object.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.