org.apache.ddlutils.model
Class Column

java.lang.Object
  extended by org.apache.ddlutils.model.Column
All Implemented Interfaces:
Serializable, Cloneable

public class Column
extends Object
implements Cloneable, Serializable

Represents a column in the database model.

Version:
$Revision: 463305 $
See Also:
Serialized Form

Constructor Summary
Column()
           
 
Method Summary
 Object clone()
          
 boolean equals(Object obj)
          
 String getDefaultValue()
          Returns the default value of the column.
 String getDescription()
          Returns the description of the column.
 String getJavaName()
          Returns the java name of the column.
 String getName()
          Returns the name of the column.
 Object getParsedDefaultValue()
          Tries to parse the default value of the column and returns it as an object of the corresponding java type.
 int getPrecisionRadix()
          Returns the precision radix of the column.
 int getScale()
          Returns the scale of the column.
 String getSize()
          Returns the size of the column.
 int getSizeAsInt()
          Returns the size of the column as an integer.
 String getType()
          Returns the JDBC type of the column.
 int getTypeCode()
          Returns the code (one of the constants in Types) of the JDBC type of the column.
 int hashCode()
          
 boolean isAutoIncrement()
          Determines whether this column is an auto-increment column.
 boolean isOfBinaryType()
          Determines whether this column is of a binary type.
 boolean isOfNumericType()
          Determines whether this column is of a numeric type.
 boolean isOfSpecialType()
          Determines whether this column is of a special type.
 boolean isOfTextType()
          Determines whether this column is of a text type.
 boolean isPrimaryKey()
          Determines whether this column is a primary key column.
 boolean isRequired()
          Determines whether this column is a required column, ie.
 void setAutoIncrement(boolean autoIncrement)
          Specifies whether this column is an auto-increment column.
 void setDefaultValue(String defaultValue)
          Sets the default value of the column.
 void setDescription(String description)
          Sets the description of the column.
 void setJavaName(String javaName)
          Sets the java name of the column.
 void setName(String name)
          Sets the name of the column.
 void setPrecisionRadix(int precisionRadix)
          Sets the precision radix of the column.
 void setPrimaryKey(boolean primaryKey)
          Specifies whether this column is a primary key column.
 void setRequired(boolean required)
          Specifies whether this column is a required column, ie.
 void setScale(int scale)
          Sets the scale of the column.
 void setSize(String size)
          Sets the size of the column.
 void setSizeAndScale(int size, int scale)
          Sets both the size and scale.
 void setType(String type)
          Sets the JDBC type of the column.
 void setTypeCode(int typeCode)
          Sets the code (one of the constants in Types) of the JDBC type of the column.
 String toString()
          
 String toVerboseString()
          Returns a verbose string representation of this column.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Column

public Column()
Method Detail

getName

public String getName()
Returns the name of the column.

Returns:
The name

setName

public void setName(String name)
Sets the name of the column.

Parameters:
name - The name

getJavaName

public String getJavaName()
Returns the java name of the column. This property is unused by DdlUtils and only for Torque compatibility.

Returns:
The java name

setJavaName

public void setJavaName(String javaName)
Sets the java name of the column. This property is unused by DdlUtils and only for Torque compatibility.

Parameters:
javaName - The java name

getDescription

public String getDescription()
Returns the description of the column.

Returns:
The description

setDescription

public void setDescription(String description)
Sets the description of the column.

Parameters:
description - The description

isPrimaryKey

public boolean isPrimaryKey()
Determines whether this column is a primary key column.

Returns:
true if this column is a primary key column

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Specifies whether this column is a primary key column.

Parameters:
primaryKey - true if this column is a primary key column

isRequired

public boolean isRequired()
Determines whether this column is a required column, ie. that it is not allowed to contain NULL values.

Returns:
true if this column is a required column

setRequired

public void setRequired(boolean required)
Specifies whether this column is a required column, ie. that it is not allowed to contain NULL values.

Parameters:
required - true if this column is a required column

isAutoIncrement

public boolean isAutoIncrement()
Determines whether this column is an auto-increment column.

Returns:
true if this column is an auto-increment column

setAutoIncrement

public void setAutoIncrement(boolean autoIncrement)
Specifies whether this column is an auto-increment column.

Parameters:
autoIncrement - true if this column is an auto-increment column

getTypeCode

public int getTypeCode()
Returns the code (one of the constants in Types) of the JDBC type of the column.

Returns:
The type code

setTypeCode

public void setTypeCode(int typeCode)
Sets the code (one of the constants in Types) of the JDBC type of the column.

Parameters:
typeCode - The type code

getType

public String getType()
Returns the JDBC type of the column.

Returns:
The type

setType

public void setType(String type)
Sets the JDBC type of the column.

Parameters:
type - The type

isOfNumericType

public boolean isOfNumericType()
Determines whether this column is of a numeric type.

Returns:
true if this column is of a numeric type

isOfTextType

public boolean isOfTextType()
Determines whether this column is of a text type.

Returns:
true if this column is of a text type

isOfBinaryType

public boolean isOfBinaryType()
Determines whether this column is of a binary type.

Returns:
true if this column is of a binary type

isOfSpecialType

public boolean isOfSpecialType()
Determines whether this column is of a special type.

Returns:
true if this column is of a special type

getSize

public String getSize()
Returns the size of the column.

Returns:
The size

getSizeAsInt

public int getSizeAsInt()
Returns the size of the column as an integer.

Returns:
The size as an integer

setSize

public void setSize(String size)
Sets the size of the column. This is either a simple integer value or a comma-separated pair of integer values specifying the size and scale.

Parameters:
size - The size

getScale

public int getScale()
Returns the scale of the column.

Returns:
The scale

setScale

public void setScale(int scale)
Sets the scale of the column.

Parameters:
scale - The scale

setSizeAndScale

public void setSizeAndScale(int size,
                            int scale)
Sets both the size and scale.

Parameters:
size - The size
scale - The scale

getPrecisionRadix

public int getPrecisionRadix()
Returns the precision radix of the column.

Returns:
The precision radix

setPrecisionRadix

public void setPrecisionRadix(int precisionRadix)
Sets the precision radix of the column.

Parameters:
precisionRadix - The precision radix

getDefaultValue

public String getDefaultValue()
Returns the default value of the column.

Returns:
The default value

getParsedDefaultValue

public Object getParsedDefaultValue()
Tries to parse the default value of the column and returns it as an object of the corresponding java type. If the value could not be parsed, then the original definition is returned.

Returns:
The parsed default value

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the default value of the column. Note that this expression will be used within quotation marks when generating the column, and thus is subject to the conversion rules of the target database.

Parameters:
defaultValue - The default value

clone

public Object clone()
             throws CloneNotSupportedException

Overrides:
clone in class Object
Throws:
CloneNotSupportedException

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

toVerboseString

public String toVerboseString()
Returns a verbose string representation of this column.

Returns:
The string representation


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.