Package org.jumpmind.db.model
Class Column
java.lang.Object
org.jumpmind.db.model.Column
- All Implemented Interfaces:
Serializable
,Cloneable
Represents a column in the database model.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlatformColumn
(PlatformColumn platformColumn) boolean
boolean
boolean
clone()
boolean
boolean
boolean
equalsByName
(Column other) findPlatformColumn
(String name) int
Returns the default value of the column.Returns the description of the column.Returns the java name of the column.int
Returns the JDBC type of the column.int
Returns the code (one of the constants inTypes
) of the JDBC type of the column.getName()
Returns the name of the column.Tries to parse the default value of the column and returns it as an object of the corresponding java type.int
Returns the precision radix of the column.int
int
getScale()
Returns the scale of the column.getSize()
Returns the size of the column.int
Returns the size of the column as an integer.int
hashCode()
boolean
Determines whether this column is an auto-increment column.boolean
boolean
boolean
Determines whether this column has an expression for a default value.boolean
Determines whether this column is a generated/computed/virtual column.boolean
Determines whether this column is of a binary type.boolean
Determines whether this column is of a numeric type.boolean
Determines whether this column is of a special type.boolean
Determines whether this column is of a text type.boolean
Determines whether this column is a primary key column.boolean
Determines whether this column is a required column, ie.boolean
boolean
isUnique()
Determines whether this column is an unique column.void
removePlatformColumn
(String databaseName) void
setAutoIncrement
(boolean autoIncrement) Specifies whether this column is an auto-increment column.void
setAutoUpdate
(boolean autoUpdate) void
setCharOctetLength
(int charOctetLength) void
setDefaultValue
(String defaultValue) Sets the default value of the column.void
setDescription
(String description) Sets the description of the column.void
setDistributionKey
(boolean distributionKey) void
setExpressionAsDefaultValue
(boolean expressionAsDefaultValue) Specifies whether this column has an expression for a default value.void
setGenerated
(boolean generated) Specifies whether this column is a generated/computed/virtual column.void
setJavaName
(String javaName) Sets the java name of the column.final void
setJdbcTypeCode
(int jdbcTypeCode) void
setJdbcTypeName
(String jdbcTypeName) void
setMappedType
(String type) Sets the JDBC type of the column.final void
setMappedTypeCode
(int typeCode) Sets the code (one of the constants inTypes
) of the JDBC type of the column.void
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
setPrimaryKeySequence
(int primaryKeySequence) void
setRequired
(boolean required) Specifies whether this column is a required column, ie.void
setScale
(int scale) Sets the scale of the column.void
Sets the size of the column.final void
setSizeAndScale
(int size, int scale) Sets both the size and scale.final void
setTypeCode
(int typeCode) void
setUnique
(boolean unique) Specifies whether this column is an unique column.toString()
Returns a verbose string representation of this column.
-
Constructor Details
-
Column
public Column() -
Column
-
Column
-
Column
-
-
Method Details
-
getName
Returns the name of the column.- Returns:
- The name
-
setName
Sets the name of the column.- Parameters:
name
- The name
-
getJavaName
Returns the java name of the column. This property is unused by DdlUtils and only for Torque compatibility.- Returns:
- The java name
-
setJavaName
Sets the java name of the column. This property is unused by DdlUtils and only for Torque compatibility.- Parameters:
javaName
- The java name
-
getDescription
Returns the description of the column.- Returns:
- The description
-
setDescription
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 containNULL
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 containNULL
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
-
isUnique
public boolean isUnique()Determines whether this column is an unique column.- Returns:
true
if this column is a unique column
-
setUnique
public void setUnique(boolean unique) Specifies whether this column is an unique column.- Parameters:
unique
-true
if this column is a unique column
-
isGenerated
public boolean isGenerated()Determines whether this column is a generated/computed/virtual column.- Returns:
true
if this column is a generated/computed/virtual column
-
setGenerated
public void setGenerated(boolean generated) Specifies whether this column is a generated/computed/virtual column.- Parameters:
generated
-true
if this column is a generated/computed/virtual column
-
isExpressionAsDefaultValue
public boolean isExpressionAsDefaultValue()Determines whether this column has an expression for a default value.- Returns:
true
if this column has an expression for a default value
-
setExpressionAsDefaultValue
public void setExpressionAsDefaultValue(boolean expressionAsDefaultValue) Specifies whether this column has an expression for a default value.- Parameters:
expressionAsDefaultValue
-true
if this column has an expression for a default value
-
getMappedTypeCode
public int getMappedTypeCode()Returns the code (one of the constants inTypes
) of the JDBC type of the column.- Returns:
- The type code
-
setMappedTypeCode
public final void setMappedTypeCode(int typeCode) Sets the code (one of the constants inTypes
) of the JDBC type of the column.- Parameters:
typeCode
- The type code
-
getMappedType
Returns the JDBC type of the column.- Returns:
- The type
-
setMappedType
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
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
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 final void setSizeAndScale(int size, int scale) Sets both the size and scale.- Parameters:
size
- The sizescale
- 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
Returns the default value of the column.- Returns:
- The default value
-
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
-
removePlatformColumn
-
addPlatformColumn
-
getPlatformColumns
-
findPlatformColumn
-
anyPlatformColumnNameContains
-
anyPlatformColumnTypeContains
-
allPlatformColumnNamesContain
-
setDefaultValue
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
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
equals
-
equalsByName
-
hashCode
public int hashCode() -
toString
-
toVerboseString
Returns a verbose string representation of this column.- Returns:
- The string representation
-
setJdbcTypeName
-
getJdbcTypeName
-
isDistributionKey
public boolean isDistributionKey() -
setDistributionKey
public void setDistributionKey(boolean distributionKey) -
setTypeCode
public final void setTypeCode(int typeCode) -
setJdbcTypeCode
public final void setJdbcTypeCode(int jdbcTypeCode) -
getJdbcTypeCode
public int getJdbcTypeCode() -
isTimestampWithTimezone
public boolean isTimestampWithTimezone() -
containsJdbcTypes
public boolean containsJdbcTypes() -
getCharOctetLength
public int getCharOctetLength() -
setCharOctetLength
public void setCharOctetLength(int charOctetLength) -
getPrimaryKeySequence
public int getPrimaryKeySequence() -
setPrimaryKeySequence
public void setPrimaryKeySequence(int primaryKeySequence) -
isAutoUpdate
public boolean isAutoUpdate() -
setAutoUpdate
public void setAutoUpdate(boolean autoUpdate)
-