Ontimize 5.2072EN

com.ontimize.db.sql
Class SQLColumn

java.lang.Object
  extended bycom.ontimize.db.sql.SQLColumn
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SQLColumn
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Class that contains all the information necessary to define a column into a database.

Author:
Imatia Innovation
See Also:
Serialized Form

Field Summary
protected  java.lang.String columnName
          The name of the column.
protected  int columnSQLSize
          The SQL size of the column.
protected  int columnSQLType
          The SQl Type of the column.
protected  java.lang.Object defaultValue
          The default value to this column.
protected  boolean primaryKey
          Parameter that indicates if the column is PRIMARY KEY.
protected  boolean required
          Parameter that indicates if the column is required, that is, if it accepts or not Null values.
protected  boolean unique
          Parameter that indicates if the column is UNIQUE.
 
Constructor Summary
SQLColumn(java.lang.String columnName, int columnSQLType)
          Creates a new SQLColumn indicating the name of the column and the SQL Type of it.
SQLColumn(java.lang.String columnName, int columnSQLType, boolean primaryKey)
          Creates a new SQLColumn indicating the name of the column, the SQL Type of it and the parameter primaryKey.
SQLColumn(java.lang.String columnName, int columnSQLType, boolean primaryKey, boolean required)
          Creates a new SQLColumn indicating the name of the column, the SQL Type of it, the parameter primaryKey and the parameter required.
 
Method Summary
 java.lang.String getColumnName()
          Returns the name of the column.
 int getColumnSQLSize()
          Returns the SQL size of the column.
 int getColumnSQLType()
          Returns the SQL Type of the column.
 java.lang.Object getDefaultValue()
          Returns the default value to this column.
 boolean isPrimaryKey()
          Checks if the current column is part of a Primary Key.
 boolean isRequired()
          Checks if the current column is required.
 boolean isUnique()
          Checks if the current column is unique.
 void setColumnName(java.lang.String columnName)
          Sets the name of the column.
 void setColumnSQLSize(int columnSQLSize)
          Sets the SQL size of the column.
 void setColumnSQLType(int columnSQLType)
          Sets the SQL Type of the column.
 void setDefaultValue(java.lang.Object defaultValue)
          Sets de default value to this column.
 void setPrimaryKey(boolean primaryKey)
          Sets the value of the parameter primaryKey.
 void setRequired(boolean required)
          Sets the value of the parameter required.
 void setUnique(boolean unique)
          Sets the value of the parameter unique.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnName

protected java.lang.String columnName
The name of the column.


columnSQLType

protected int columnSQLType
The SQl Type of the column.


columnSQLSize

protected int columnSQLSize
The SQL size of the column.


unique

protected boolean unique
Parameter that indicates if the column is UNIQUE.


primaryKey

protected boolean primaryKey
Parameter that indicates if the column is PRIMARY KEY.


required

protected boolean required
Parameter that indicates if the column is required, that is, if it accepts or not Null values.


defaultValue

protected java.lang.Object defaultValue
The default value to this column.

Constructor Detail

SQLColumn

public SQLColumn(java.lang.String columnName,
                 int columnSQLType)
Creates a new SQLColumn indicating the name of the column and the SQL Type of it.

Parameters:
columnName - The name of the column.
columnSQLType - The int value to the SQL Type.

SQLColumn

public SQLColumn(java.lang.String columnName,
                 int columnSQLType,
                 boolean primaryKey)
Creates a new SQLColumn indicating the name of the column, the SQL Type of it and the parameter primaryKey. If this parameter is true this column will be set as Primary Key.

Parameters:
columnName - The name of the column.
columnSQLType - The int value to the SQL Type.
primaryKey - The value of parameter primaryKey. If it is true the column will be set as Primary Key.

SQLColumn

public SQLColumn(java.lang.String columnName,
                 int columnSQLType,
                 boolean primaryKey,
                 boolean required)
Creates a new SQLColumn indicating the name of the column, the SQL Type of it, the parameter primaryKey and the parameter required. If the parameter prikaryKey is true this column will be set as Primary Key. As well if the parameter required is true, the column will be set as Required, that is, it doesn't admit null values.

Parameters:
columnName - The name of the column.
columnSQLType - The int value to the SQL Type.
primaryKey - The value of parameter primaryKey. If it is true the column will be set as Primary Key.
required - The value of parameter required. If it is true the column will be set as Required (doesn't admit null values).
Method Detail

getColumnName

public java.lang.String getColumnName()
Returns the name of the column.

Returns:
a String with the column's name.

setColumnName

public void setColumnName(java.lang.String columnName)
Sets the name of the column.

Parameters:
columnName - String with the name of the column.

getColumnSQLType

public int getColumnSQLType()
Returns the SQL Type of the column.

Returns:
a int with the column's SQL Type.

setColumnSQLType

public void setColumnSQLType(int columnSQLType)
Sets the SQL Type of the column.

Parameters:
columnSQLType - An int with the SQL Type to this column.

isPrimaryKey

public boolean isPrimaryKey()
Checks if the current column is part of a Primary Key. If it is true, the column is part of a Primary Key

Returns:
a boolean

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Sets the value of the parameter primaryKey. If it is true it indicates that the column will be Primary Key.

Parameters:
primaryKey - A boolean that sets the value of the parameter primaryKey.

isRequired

public boolean isRequired()
Checks if the current column is required. If it is true, the column doesn't admit null values.

Returns:
a boolean

setRequired

public void setRequired(boolean required)
Sets the value of the parameter required. If it is true it indicates that the column will be required, that it, it doesn't admit null values.

Parameters:
required - A boolean that sets the value of the parameter required.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value to this column.

Returns:
an Object with the default value.

setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
Sets de default value to this column.

Parameters:
defaultValue - Object with the default value.

getColumnSQLSize

public int getColumnSQLSize()
Returns the SQL size of the column.

Returns:
a int with the SQL size of the column.

setColumnSQLSize

public void setColumnSQLSize(int columnSQLSize)
Sets the SQL size of the column.

Parameters:
columnSQLSize - int with the SQL size of the column.

isUnique

public boolean isUnique()
Checks if the current column is unique. If it is true it indicates that the column will be Unique.

Returns:
a boolean

setUnique

public void setUnique(boolean unique)
Sets the value of the parameter unique. If it is true it indicates that the column will be unique.

Parameters:
unique - A boolean that sets the value of the parameter unique.

Ontimize