|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.engine.database.model.Column
A Class for holding data about a column used in an Application.
Field Summary | |
private java.lang.Object |
columnType
|
private java.lang.String |
defaultValue
|
private java.lang.String |
description
|
private java.util.List |
inheritanceList
|
private java.lang.String |
inheritanceType
|
private java.lang.String |
inputValidator
class name to do input validation on this column |
private boolean |
isAutoIncrement
|
private boolean |
isEnumeratedClasses
|
private boolean |
isInheritance
|
private boolean |
isNotNull
|
private boolean |
isPrimaryKey
|
private boolean |
isUnique
|
private java.lang.String |
javaName
|
private java.lang.String |
javaNamingMethod
|
private java.lang.String |
javaType
|
private static org.apache.commons.logging.Log |
log
Logging class from commons.logging |
private java.lang.String |
name
|
private boolean |
needsTransactionInPostgres
|
private Table |
parentTable
|
private int |
position
|
private java.util.List |
referrers
|
private java.lang.String |
size
|
private java.lang.String |
torqueType
type as defined in schema.xml |
Constructor Summary | |
Column()
Creates a new instance with a null name. |
|
Column(java.lang.String name)
Creates a new column and set the name |
Method Summary | |
Inheritance |
addInheritance(org.xml.sax.Attributes attrib)
A utility function to create a new column from attrib and add it to this table. |
void |
addInheritance(Inheritance inh)
Adds a new inheritance definition to the inheritance list and set the parent column of the inheritance to the current column |
void |
addReferrer(ForeignKey fk)
Adds the foreign key from another table that refers to this column. |
java.util.List |
getChildren()
Get the inheritance definitions. |
java.lang.String |
getDefaultSetting()
Return a string that will give this column a default value. |
java.lang.String |
getDefaultValue()
Get a string that will give this column a default value. |
java.lang.String |
getDescription()
Get the description for the Table |
ForeignKey |
getForeignKey()
get the foreign key object for this column if it is a foreign key or part of a foreign key |
java.lang.String |
getFullyQualifiedName()
Returns table.column |
java.lang.String |
getInputValidator()
Returns the class name to do input validation |
java.lang.String |
getJavaName()
Get name to use in Java sources to build method names. |
java.lang.String |
getJavaNative()
Return a string representation of the native java type which corresponds to the JDBC type of this column. |
java.lang.String |
getJavaObject()
Return a string representation of the Java object which corresponds to the JDBC type of this column. |
java.lang.String |
getJavaPrimitive()
Return a string representation of the primitive java type which corresponds to the JDBC type of this column. |
java.lang.String |
getJavaType()
Get type to use in Java sources |
java.lang.String |
getName()
Get the name of the column |
java.lang.String |
getParameterParserMethod()
Return ParameterParser getX() method which corresponds to the JDBC type which represents this column. |
int |
getPosition()
Get the location of this column within the table (one-based). |
java.util.List |
getReferrers()
Get list of references to this column. |
java.lang.String |
getRelatedColumnName()
Utility method to get the related column of this local column if this column is a foreign key or part of a foreign key. |
java.lang.String |
getRelatedTableName()
Utility method to get the related table of this column if it is a foreign key or part of a foreign key |
java.lang.String |
getSize()
Returns the size of the column |
Table |
getTable()
Get the parent Table of the column |
java.lang.String |
getTableName()
Returns the Name of the table the column is in |
java.lang.Object |
getTorqueType()
Returns the column type as given in the schema as an object |
java.lang.Object |
getType()
Returns the column jdbc type as an object |
java.lang.String |
getUncapitalisedJavaName()
Get variable name to use in Java sources (= uncapitalised java name) |
java.lang.String |
getVillageMethod()
Return Village asX() method which corresponds to the JDBC type which represents this column. |
boolean |
isAutoIncrement()
Return auto increment/sequence string for the target database. |
boolean |
isBooleanChar()
Returns true if the column type is boolean in the java object and a String ("Y" or "N") in the db. |
boolean |
isBooleanInt()
Returns true if the column type is boolean in the java object and a numeric (1 or 0) in the db. |
boolean |
isEnumeratedClasses()
Determine if possible classes have been enumerated in the xml file. |
boolean |
isForeignKey()
Utility method to determine if this column is a foreign key. |
boolean |
isInheritance()
Determine if this column is a normal property or specifies a the classes that are represented in the table containing this column. |
boolean |
isMultipleFK()
Determine if this column is a foreign key that refers to the same table as another foreign key column in this table. |
boolean |
isNotNull()
Return the isNotNull property of the column |
boolean |
isPrimaryKey()
Return true if the column is a primary key |
boolean |
isPrimitive()
returns true, if the columns java native type is an boolean, byte, short, int, long, float, double, char |
boolean |
isString()
Utility method to see if the column is a string |
boolean |
isUnique()
Get the UNIQUE property |
boolean |
isUsePrimitive()
|
void |
loadFromXML(org.xml.sax.Attributes attrib)
Imports a column from an XML specification |
static java.lang.String |
makeList(java.util.List columns)
Return a comma delimited string listing the specified columns. |
boolean |
needEscapedValue()
Utility method to return the value as an element to be usable in an SQL insert statement. |
java.lang.String |
printSize()
Return the size in brackets for use in an sql schema if the type is String. |
boolean |
requiresTransactionInPostgres()
Return true if the column requires a transaction in Postgres |
void |
setAutoIncrement(boolean value)
Set the auto increment value. |
void |
setDefaultValue(java.lang.String def)
Set a string that will give this column a default value. |
void |
setDescription(java.lang.String newDescription)
Set the description for the Table |
void |
setJavaName(java.lang.String javaName)
Set name to use in Java sources |
void |
setName(java.lang.String newName)
Set the name of the column |
void |
setNotNull(boolean status)
Set the isNotNull property of the column |
void |
setPosition(int v)
Get the location of this column within the table (one-based). |
void |
setPrimaryKey(boolean pk)
Set if the column is a primary key or not |
void |
setSize(java.lang.String newSize)
Set the size of the column |
void |
setTable(Table parent)
Set the parent Table of the column |
void |
setType(java.lang.String torqueType)
Returns the colunm type |
void |
setTypeFromString(java.lang.String typeName,
java.lang.String size)
Set the column type from a string property (normally a string from an sql input file) |
void |
setUnique(boolean u)
Set true if the column is UNIQUE |
java.lang.String |
toString()
String representation of the column. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
private java.lang.String name
private java.lang.String description
private java.lang.String javaName
private java.lang.String javaNamingMethod
private boolean isNotNull
private java.lang.String size
private java.lang.String torqueType
private java.lang.String javaType
private java.lang.Object columnType
private Table parentTable
private int position
private boolean isPrimaryKey
private boolean isUnique
private boolean isAutoIncrement
private java.lang.String defaultValue
private java.util.List referrers
private java.lang.String inheritanceType
private boolean isInheritance
private boolean isEnumeratedClasses
private java.util.List inheritanceList
private boolean needsTransactionInPostgres
private java.lang.String inputValidator
Constructor Detail |
public Column()
null
name.
public Column(java.lang.String name)
name
- column nameMethod Detail |
public static java.lang.String makeList(java.util.List columns)
columns
- Either a list of Column
objects, or
a list of String
objects with column names.public void loadFromXML(org.xml.sax.Attributes attrib)
public java.lang.String getFullyQualifiedName()
public java.lang.String getName()
public void setName(java.lang.String newName)
public java.lang.String getDescription()
public void setDescription(java.lang.String newDescription)
newDescription
- description for the Tablepublic java.lang.String getJavaName()
public java.lang.String getUncapitalisedJavaName()
public void setJavaName(java.lang.String javaName)
public java.lang.String getJavaType()
public int getPosition()
public void setPosition(int v)
v
- Value to assign to position.public void setTable(Table parent)
public Table getTable()
public java.lang.String getTableName()
public Inheritance addInheritance(org.xml.sax.Attributes attrib)
public void addInheritance(Inheritance inh)
public java.util.List getChildren()
public boolean isInheritance()
public boolean isEnumeratedClasses()
public boolean isNotNull()
public void setNotNull(boolean status)
public void setPrimaryKey(boolean pk)
public boolean isPrimaryKey()
public void setUnique(boolean u)
public boolean isUnique()
public boolean requiresTransactionInPostgres()
public boolean isForeignKey()
public boolean isMultipleFK()
public ForeignKey getForeignKey()
public java.lang.String getRelatedTableName()
public java.lang.String getRelatedColumnName()
public void addReferrer(ForeignKey fk)
public java.util.List getReferrers()
public void setType(java.lang.String torqueType)
public java.lang.Object getType()
public java.lang.Object getTorqueType()
public boolean isString()
public boolean needEscapedValue()
public java.lang.String toString()
public java.lang.String getSize()
public void setSize(java.lang.String newSize)
public java.lang.String printSize()
public java.lang.String getDefaultSetting()
TODO: Properly SQL-escape text values.
public void setDefaultValue(java.lang.String def)
public java.lang.String getDefaultValue()
public java.lang.String getInputValidator()
public boolean isAutoIncrement()
public void setAutoIncrement(boolean value)
public void setTypeFromString(java.lang.String typeName, java.lang.String size)
public java.lang.String getJavaObject()
public java.lang.String getJavaPrimitive()
public java.lang.String getJavaNative()
public java.lang.String getVillageMethod()
public java.lang.String getParameterParserMethod()
public boolean isBooleanInt()
public boolean isBooleanChar()
public boolean isPrimitive()
public boolean isUsePrimitive()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |