Package org.apache.torque.map
Klasse ColumnMap
java.lang.Object
org.apache.torque.map.OptionSupport
org.apache.torque.map.ColumnMap
- Alle implementierten Schnittstellen:
Serializable
,Column
ColumnMap is used to model a column of a table in a database.
Note that this information should be set via the TableMapBuilder
class and
not changed by applications. The set methods are only public because this
class needs them.
- Version:
- $Id: ColumnMap.java 1850965 2019-01-10 17:21:29Z painter $
- Autor:
- John D. McNally, Greg Monroe
- Siehe auch:
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Add an associated inheritance mapping.Get the name of a column.A string representing the default value defined for this column.Returns the column description info.Get the name of the table this column is in.Gets the inheritance type used.getInheritanceMap
(String key) Get the inheritance map with the specified key.Get the inheritance information associated with this column,Gets the Java Name for this column as defined in XML or created by generator code.Returns the Java naming method for this column.Returns the java type of this column.int
Returns the position (one based) of this column in the table.int
getScale()
Gets the scale set for this column (if any) as set in the XML database definition.Get the name of the schema of the table this column is in.int
getSize()
The "precision" value from the XML size="<precision>[,<scale>]" attribute.Returns the SQL expression for the fully qualified column name.getTable()
Returns the map for the table this column belongs to.Get the name of the table this column is in.Get the name of the Torque type of this column.getType()
Get the type of this column.boolean
Returns whether this column is an autoincrement column.boolean
Is null value allowed ?boolean
isPk()
Returns whether this column is a primary key.boolean
Is this column a primary key?boolean
Returns whether getters and setters are generated with the access modifier "protected" rather than "public".boolean
Returns whether this column uses inheritance subclasses.boolean
Returns whether this column uses primitive values rather than objects.protected String
normalizeName
(String name) Makes sure that the column names don't include table prefixes.void
setAutoIncrement
(boolean autoIncrement) Sets whether this column is an autoincrement column.void
setDefault
(String defaultValue) Sets the default value for this column.void
setDescription
(String description) Sets the description for this column.void
setInheritance
(String inheritanceType) Sets the inheritance type.void
setJavaName
(String name) Sets the Java Name for this column.void
setJavaNamingMethod
(String javaNamingMethod) Sets the java naming method for this column.void
setJavaType
(String javaType) Sets the java type of this column.void
setNotNull
(boolean nn) Set if this column may be null.void
setPk
(boolean pk) Sets whether this column is a primary key.void
setPosition
(int position) Sets the position (one based) of this column in the table.void
setPrimaryKey
(boolean pk) Set if this column is a primary key or not.void
setProtected
(boolean isProtected) Sets whether getters and setters should be generated with the access modifier "protected" rather than "public".void
setScale
(int scale) void
setSize
(int size) Set the size of this column.void
setTorqueType
(String torqueType) Set the Torque type of this column.void
Set the type of this column.void
setUseInheritance
(boolean useInheritance) Sets whether this column uses inheritance subclasses.void
setUsePrimitive
(boolean usePrimitive) Sets whether this column uses primitive values rather than objects.toString()
Von Klasse geerbte Methoden org.apache.torque.map.OptionSupport
clearOptions, getOption, getOptions, setOption
-
Konstruktordetails
-
ColumnMap
Constructor.- Parameter:
name
- The name of the column.containingTable
- TableMap of the table this column is in.
-
-
Methodendetails
-
normalizeName
Makes sure that the column names don't include table prefixes. E.g., SCARAB_PROJECT.PROJECT_ID should be PROJECT_ID.- Parameter:
name
- The name to check- Gibt zurück:
- The corrected name if needed or the same name if not.
-
getColumnName
Get the name of a column.- Angegeben von:
getColumnName
in SchnittstelleColumn
- Gibt zurück:
- A String with the column name.
-
getTableName
Get the name of the table this column is in.- Angegeben von:
getTableName
in SchnittstelleColumn
- Gibt zurück:
- A String with the table name.
-
getFullTableName
Get the name of the table this column is in.- Angegeben von:
getFullTableName
in SchnittstelleColumn
- Gibt zurück:
- A String with the table name.
-
getSchemaName
Get the name of the schema of the table this column is in.- Angegeben von:
getSchemaName
in SchnittstelleColumn
- Gibt zurück:
- A String with the schema name, or null if no schema is given.
-
setType
Set the type of this column.- Parameter:
type
- An Object specifying the type.
-
setTorqueType
Set the Torque type of this column.- Parameter:
torqueType
- the Torque type of the column.
-
setSize
public void setSize(int size) Set the size of this column.- Parameter:
size
- An int specifying the size.
-
setPrimaryKey
public void setPrimaryKey(boolean pk) Set if this column is a primary key or not.- Parameter:
pk
- True if column is a primary key.
-
setNotNull
public void setNotNull(boolean nn) Set if this column may be null.- Parameter:
nn
- True if column may be null.
-
getType
Get the type of this column. Note that if usePrimitive is true, this may need to be converted.- Gibt zurück:
- An Object specifying the type.
-
getTorqueType
Get the name of the Torque type of this column.- Gibt zurück:
- The name of the Torque type of this column.
-
getSize
public int getSize()The "precision" value from the XML size="<precision>[,<scale>]" attribute. Where [,<scale>] is optional. If the size attribute has not been set in the XML, it will return 0.Note that the size="P,S" format should be replaced with size="P" scale="S".
- Gibt zurück:
- An int specifying the size.
-
isPrimaryKey
public boolean isPrimaryKey()Is this column a primary key?- Gibt zurück:
- True if column is a primary key.
-
isNotNull
public boolean isNotNull()Is null value allowed ?- Gibt zurück:
- True if column may be null.
-
getScale
public int getScale()Gets the scale set for this column (if any) as set in the XML database definition. E.g., the value of the scale attribute or the scale portion of a size="P,S" attribute. (Note: size="P,S" format is being deprecated!).- Gibt zurück:
- Returns the scale.
-
setScale
public void setScale(int scale) - Parameter:
scale
- The scale to set.
-
getJavaName
Gets the Java Name for this column as defined in XML or created by generator code.- Gibt zurück:
- the Java Name.
-
setJavaName
Sets the Java Name for this column.- Parameter:
name
- the Java Name.
-
isAutoIncrement
public boolean isAutoIncrement()Returns whether this column is an autoincrement column.- Gibt zurück:
- true if this column is an autoIncrement column, false otherwise.
-
setAutoIncrement
public void setAutoIncrement(boolean autoIncrement) Sets whether this column is an autoincrement column.- Parameter:
autoIncrement
- whether this colimn is an autoincrement column.
-
getDefault
A string representing the default value defined for this column.- Gibt zurück:
- The default value of this column, if any.
-
setDefault
Sets the default value for this column.- Parameter:
defaultValue
- The defaultValue to set.
-
getDescription
Returns the column description info.- Gibt zurück:
- the description, if any.
-
setDescription
Sets the description for this column.- Parameter:
description
- The description to set.
-
getInheritanceMaps
Get the inheritance information associated with this column,- Gibt zurück:
- Returns an array of associated inheritanceMap. The array is in XML order.
-
addInheritanceMap
Add an associated inheritance mapping.- Parameter:
map
- The inheritanceMap to associate with this column.
-
getInheritance
Gets the inheritance type used.- Gibt zurück:
- the inheritance type used.
-
setInheritance
Sets the inheritance type.- Parameter:
inheritanceType
- The inheritance type to set.
-
isProtected
public boolean isProtected()Returns whether getters and setters are generated with the access modifier "protected" rather than "public".- Gibt zurück:
- whether the accessors should be protected rather than public.
-
setProtected
public void setProtected(boolean isProtected) Sets whether getters and setters should be generated with the access modifier "protected" rather than "public".- Parameter:
isProtected
- whether getters and setters for this column are protected.
-
isPk
public boolean isPk()Returns whether this column is a primary key.- Gibt zurück:
- whether this column is a primary key.
-
setPk
public void setPk(boolean pk) Sets whether this column is a primary key.- Parameter:
pk
- whether this column is a primary key.
-
isUseInheritance
public boolean isUseInheritance()Returns whether this column uses inheritance subclasses.- Gibt zurück:
- true if inheritance subclasses are used, false otherwise.
-
setUseInheritance
public void setUseInheritance(boolean useInheritance) Sets whether this column uses inheritance subclasses.- Parameter:
useInheritance
- whether this column uses Inheritance subclasses.
-
getInheritanceMap
Get the inheritance map with the specified key.- Parameter:
key
- the key of the inheritance map.- Gibt zurück:
- the inheritance map with the specified key, or null if no inheritance map with the specified key exists in this column.
-
isUsePrimitive
public boolean isUsePrimitive()Returns whether this column uses primitive values rather than objects.- Gibt zurück:
- true if this column uses primitive values, false if it uses objects.
-
setUsePrimitive
public void setUsePrimitive(boolean usePrimitive) Sets whether this column uses primitive values rather than objects.- Parameter:
usePrimitive
- whether primitive objects are used rather than objects.
-
getJavaNamingMethod
Returns the Java naming method for this column.- Gibt zurück:
- the javaNamingMethod for this column.
-
setJavaNamingMethod
Sets the java naming method for this column.- Parameter:
javaNamingMethod
- The javaNamingMethod to set.
-
getTable
Returns the map for the table this column belongs to.- Gibt zurück:
- the table map for this column.
-
getPosition
public int getPosition()Returns the position (one based) of this column in the table. XML order is preserved.- Gibt zurück:
- The position of this column, one-based.
-
setPosition
public void setPosition(int position) Sets the position (one based) of this column in the table.- Parameter:
position
- The position to set.
-
getJavaType
Returns the java type of this column.- Gibt zurück:
- the javaType.
-
setJavaType
Sets the java type of this column.- Parameter:
javaType
- The javaType to set.
-
getSqlExpression
Returns the SQL expression for the fully qualified column name. This is tableName.columnName if the database for this column has no schema and defaultSchema is null, or schemaName.tableName.columnName with a schema (the database schema overrides the default schema if both are given).- Angegeben von:
getSqlExpression
in SchnittstelleColumn
- Gibt zurück:
- the SQL expression for the column, not null.
-
toString
-