org.objectweb.cjdbc.common.sql.schema
Class DatabaseColumn

java.lang.Object
  extended byorg.objectweb.cjdbc.common.sql.schema.DatabaseColumn
All Implemented Interfaces:
java.io.Serializable

public class DatabaseColumn
extends java.lang.Object
implements java.io.Serializable

A DatabaseColumn represents a column of a database table. It is composed of a name, type (not used yet) and a boolean indicated whether or not rows are unique or not (like primary keys or columns created explicitely with the UNIQUE keyword).

Version:
1.0
Author:
Emmanuel Cecchet, Julie Marguerite
See Also:
Serialized Form

Field Summary
private  boolean isUnique
          true if this column has a UNIQUE constraint (like primary keys for example).
private  java.lang.String name
          Column name.
private static long serialVersionUID
           
private  int type
          Type of the column (VARCHAR,TEXT, ...).
 
Constructor Summary
DatabaseColumn(java.lang.String name, boolean isUnique)
          Creates a new DatabaseColumn instance.
DatabaseColumn(java.lang.String name, boolean isUnique, int type)
          Creates a new DatabaseColumn instance.
 
Method Summary
 boolean equals(java.lang.Object other)
          Two DatabaseColumn are considered equal if they have the same name and type and if they are both unique or both non unique.
 boolean equalsIgnoreType(java.lang.Object other)
          This function is the same as equal but ignores the column type.
 java.lang.String getName()
          Gets the column name.
 int getType()
          Returns the column type according to java.sql.Types.
 java.lang.String getXml()
          Get xml information about this column.
 boolean isUnique()
          Tests if the column has a UNIQUE constraint (like primary keys for example).
 void setIsUnique(boolean bool)
          Sets the value of isUnique.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

name

private java.lang.String name
Column name.


isUnique

private boolean isUnique
true if this column has a UNIQUE constraint (like primary keys for example).


type

private int type
Type of the column (VARCHAR,TEXT, ...).

Constructor Detail

DatabaseColumn

public DatabaseColumn(java.lang.String name,
                      boolean isUnique)
Creates a new DatabaseColumn instance.

Parameters:
name - name of the column
isUnique - true if this column has a UNIQUE constraint

DatabaseColumn

public DatabaseColumn(java.lang.String name,
                      boolean isUnique,
                      int type)
Creates a new DatabaseColumn instance.

Parameters:
name - name of the column
isUnique - true if this column has a UNIQUE constraint
type - type of the column (VARCHAR,TEXT, ...)
Method Detail

getName

public java.lang.String getName()
Gets the column name.

Returns:
a String value.

isUnique

public boolean isUnique()
Tests if the column has a UNIQUE constraint (like primary keys for example).

Returns:
true if the column has a UNIQUE constraint

setIsUnique

public void setIsUnique(boolean bool)
Sets the value of isUnique.

Parameters:
bool - true if the column has a UNIQUE constraint (like primary keys for example).

getType

public int getType()
Returns the column type according to java.sql.Types.

Returns:
the column type. Returns Types.NULL if the type is not set.
See Also:
Types

equals

public boolean equals(java.lang.Object other)
Two DatabaseColumn are considered equal if they have the same name and type and if they are both unique or both non unique.

Parameters:
other - the object to compare with
Returns:
true if the columns are equal

equalsIgnoreType

public boolean equalsIgnoreType(java.lang.Object other)
This function is the same as equal but ignores the column type.

Parameters:
other - the object to compare with
Returns:
true if the columns are equal ignoring their type.
See Also:
equals(Object)

getXml

public java.lang.String getXml()
Get xml information about this column.

Returns:
xml formatted information on this database column.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.