|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.engine.database.model.Column
public class Column
A Class for holding data about a column used in an Application.
Constructor Summary | |
---|---|
Column()
Creates a new instance with a null name. |
|
Column(String name)
Creates a new column and set the name |
Method Summary | |
---|---|
Inheritance |
addInheritance(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 |
addOption(String key,
String value)
Add an XML Specified option key/value pair to this element's option set. |
void |
addReferrer(ForeignKey fk)
Adds the foreign key from another table that refers to this column. |
String |
getAutoIncrementString()
|
List |
getChildren()
Get the inheritance definitions. |
String |
getDefaultSetting()
Deprecated. |
String |
getDefaultValue()
Get a string that will give this column a default value. |
String |
getDescription()
Get the description for the Table |
Domain |
getDomain()
|
ForeignKey |
getForeignKey()
get the foreign key object for this column if it is a foreign key or part of a foreign key |
String |
getFullyQualifiedName()
Returns table.column |
String |
getGetterName()
Returns the name for the getter method to retrieve the value of this column |
String |
getInheritanceType()
Get the value of the inheritance attribute defined in the schema XML. |
String |
getInputValidator()
Returns the class name to do input validation |
String |
getJavaName()
Get name to use in Java sources to build method names. |
String |
getJavaNative()
Return a string representation of the native java type which corresponds to the JDBC type of this column. |
String |
getJavaObject()
Return a string representation of the Java object which corresponds to the JDBC type of this column. |
String |
getJavaPrimitive()
Return a string representation of the primitive java type which corresponds to the JDBC type of this column. |
String |
getJavaType()
Returns whether the type in the java object should be an object or primitive. |
int |
getJdbcType()
|
String |
getName()
Get the name of the column |
String |
getNotNullString()
Return NOT NULL String for this column |
String |
getOption(String key)
Get the value that was associated with this key in an XML option element. |
Map |
getOptions()
Gets the full ordered hashtable array of items specified by XML option statements under this element. |
String |
getParameterParserMethod()
Return ParameterParser getX() method which corresponds to the JDBC type which represents this column. |
String |
getPeerJavaName()
Returns the name of the constant that is used for the column in the Peer class, e.g., RecordPeer.COLVARNAME. |
int |
getPosition()
Get the location of this column within the table (one-based). |
String |
getPrecision()
Try to determine the precision of the field from the size attribute. |
List |
getReferrers()
Get list of references to this column. |
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. |
String |
getRelatedTableName()
Utility method to get the related table of this column if it is a foreign key or part of a foreign key |
String |
getScale()
Try to determine the scale of the field from the scale and size attribute. |
String |
getSetterName()
Returns the name for the setter method to set the value of this column |
String |
getSize()
Returns the size of the column |
String |
getSqlString()
|
Table |
getTable()
Get the parent Table of the column |
String |
getTableName()
Returns the Name of the table the column is in |
Object |
getTorqueType()
Returns the column type as given in the schema as an object |
Object |
getType()
Deprecated. the type conversion is handled by the platform package (since torque 3.2) |
String |
getUncapitalisedJavaName()
Get variable name to use in Java sources (= uncapitalised java name) |
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 |
isBit()
Returns true if the column type is boolean in the java object and a Bit ("1" or "0") in the db. |
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 |
isCorrectGetters()
Return the correctGetters property of the column |
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 |
isProtected()
Return the isProtected property of the column |
boolean |
isString()
Deprecated. will be removed after the 3.3 release |
boolean |
isUnique()
Get the UNIQUE property |
boolean |
isUsePrimitive()
|
void |
loadFromXML(Attributes attrib)
Imports a column from an XML specification |
static String |
makeList(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. |
String |
printSize()
Return the size and scale in brackets for use in an sql schema. |
boolean |
requiresTransactionInPostgres()
Return true if the column requires a transaction in Postgres |
void |
setAutoIncrement(boolean value)
Set the auto increment value. |
void |
setCorrectGetters(boolean correctGetters)
Set the correctGetters property of the column. |
void |
setDefaultValue(String def)
Set a string that will give this column a default value. |
void |
setDescription(String newDescription)
Set the description for the Table |
void |
setDomain(Domain domain)
|
void |
setJavaName(String javaName)
Set the name to use in Java sources. |
void |
setJdbcType(int jdbcType)
|
void |
setName(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 |
setProtected(boolean prot)
Set the isProtected property of the Column |
void |
setScale(String newScale)
Set the scale of the column |
void |
setSize(String newSize)
Set the size of the column |
void |
setTable(Table parent)
Set the parent Table of the column |
void |
setType(SchemaType torqueType)
Sets the colunm type |
void |
setType(String torqueType)
Sets the colunm type |
void |
setTypeFromString(String typeName,
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 |
String |
toString()
String representation of the column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Column()
null
name.
public Column(String name)
name
- column nameMethod Detail |
---|
public static String makeList(List columns)
columns
- Either a list of Column
objects, or a list of String
objects with column names.public void loadFromXML(Attributes attrib)
public String getFullyQualifiedName()
public String getName()
public void setName(String newName)
public String getDescription()
public void setDescription(String newDescription)
newDescription
- description for the Tablepublic String getJavaName()
public String getGetterName()
public String getSetterName()
public String getUncapitalisedJavaName()
public String getPeerJavaName()
TODO: Handle delimited column names that have non-Java identifier characters in them.
public void setJavaName(String javaName)
public 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 String getTableName()
public Inheritance addInheritance(Attributes attrib)
public void addInheritance(Inheritance inh)
public List getChildren()
public boolean isInheritance()
public boolean isEnumeratedClasses()
public boolean isNotNull()
public void setNotNull(boolean status)
public String getNotNullString()
public boolean isProtected()
public void setProtected(boolean prot)
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 String getRelatedTableName()
public String getRelatedColumnName()
public void addReferrer(ForeignKey fk)
public List getReferrers()
public void setType(String torqueType)
public void setType(SchemaType torqueType)
@Deprecated public Object getType()
public Object getTorqueType()
@Deprecated public boolean isString()
public boolean needEscapedValue()
public String toString()
toString
in class Object
public String getSize()
public void setSize(String newSize)
public String getPrecision()
Note: Unparseable values will be logged as a warning.
public String getScale()
Note: Unparseable values will be logged as a warning.
public void setScale(String newScale)
public String printSize()
@Deprecated public String getDefaultSetting()
public void setDefaultValue(String def)
public String getDefaultValue()
public String getInputValidator()
public boolean isAutoIncrement()
public void setAutoIncrement(boolean value)
public String getAutoIncrementString()
public void setTypeFromString(String typeName, String size)
public String getJavaObject()
public String getJavaPrimitive()
public String getJavaNative()
public String getVillageMethod()
public String getParameterParserMethod()
public boolean isBooleanInt()
public boolean isBooleanChar()
public boolean isBit()
public boolean isPrimitive()
public boolean isUsePrimitive()
public Domain getDomain()
public void setDomain(Domain domain)
domain
- The domain to set.public String getSqlString()
public boolean isCorrectGetters()
public void setCorrectGetters(boolean correctGetters)
correctGetters
- The new value of the correctGetters property.public String getInheritanceType()
public void addOption(String key, String value)
key
- the key of the option.value
- the value of the option.public String getOption(String key)
key
- the key of the option.
public Map getOptions()
Note, this is not thread save but since it's only used for generation which is single threaded, there should be minimum danger using this in Velocity.
public int getJdbcType()
public void setJdbcType(int jdbcType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |