|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.templates.transformer.om.OMColumnTransformer
public class OMColumnTransformer
Sets the class names and packages for the OM model. The id method attribute must already be set on the parent table element when this transformer is called.
Constructor Summary | |
---|---|
OMColumnTransformer()
|
Method Summary | |
---|---|
protected void |
checkColumnNameExists(SourceElement columnElement)
Checks that the name attribute exists on the column element. |
protected void |
checkElementName(SourceElement columnElement)
Checks that the name of the column element is correct. |
static Date |
getDefaultValueAsDate(String defaultValue)
Parses the default value String as Date. |
protected String |
getDefaultValueWithDefaultSet(JavaType javaType,
String defaultValue,
boolean useDatabaseDefaultValue,
SourceElement columnElement)
Calculates the java default value of a column in case a default value is set. |
protected String |
getDefaultValueWithoutDefaultSet(JavaType javaType)
Calculates the java default value of a column in case a default value is not set. |
protected JavaType |
getFieldJavaType(SourceElement columnElement,
SchemaType schemaType)
Returns the java type of the field representing a database column. |
protected void |
setAccessModifierAttributes(SourceElement columnElement)
Sets the attributes getterAccessModifer and setterAccessModifer on the column element. |
protected void |
setAttributeDefaultValues(SourceElement columnElement)
Sets default values for attributes of the column element if the attribute is not set. |
protected void |
setDefaultValueAttribute(SourceElement columnElement,
JavaType javaType,
ControllerState controllerState)
Sets the defaultValue attribute of the column element if it is not already set. |
protected void |
setDomainAttributes(SourceElement columnElement,
ControllerState controllerState)
|
protected void |
setFieldNameAttribute(SourceElement columnElement)
Sets the fieldName attribute of the column element if it is not already set. |
protected void |
setGetterNameAttribute(SourceElement columnElement,
JavaType javaType,
ControllerState controllerState)
Sets the getterName attribute of the column element if it is not already set. |
protected void |
setJavaNameAttribute(SourceElement columnElement)
Sets the javaName attribute of the column element if it is not already set. |
protected void |
setJavaTypeAttribute(SourceElement columnElement)
Sets the javaType attribute of the column element if it is not already set and a default value is set. |
protected void |
setNumberTypeAttribute(SourceElement columnElement,
JavaType javaType)
Sets the numberType attribute of the column element if it is not already set. |
protected void |
setPeerColumnNameAttribute(SourceElement columnElement)
Sets the peerColumnName attribute of the column element if it is not already set. |
protected void |
setPrimitiveTypeAttribute(SourceElement columnElement,
JavaType javaType)
Sets the primitiveType attribute of the column element if it is not already set. |
protected void |
setQualifiedColumnNameAttribute(SourceElement columnElement)
Sets the qualifiedColumnName attribute of the column element if it is not already set. |
protected void |
setResultSetGetterAttribute(SourceElement columnElement,
SchemaType schemaType)
Sets the resultSetGetter attribute of the column element if it is not already set. |
protected void |
setSampleObjectAttribute(SourceElement columnElement,
SchemaType schemaType)
Sets the sampleObject attribute of the column element if it is not already set. |
protected void |
setSetterNameAttribute(SourceElement columnElement)
Sets the setterName attribute of the column element if it is not already set. |
protected void |
setUseDatabaseDefaultValueAttribute(SourceElement columnElement)
Sets the useDatabaseDefaultValue attribute of the column element to its default "false" if it is not already set. |
void |
transform(SourceElement columnElement,
ControllerState controllerState,
int columnPosition)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OMColumnTransformer()
Method Detail |
---|
public void transform(SourceElement columnElement, ControllerState controllerState, int columnPosition) throws SourceTransformerException
SourceTransformerException
protected void setJavaTypeAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setAttributeDefaultValues(SourceElement columnElement)
columnElement
- the column element, not null.protected void setDomainAttributes(SourceElement columnElement, ControllerState controllerState) throws SourceTransformerException
SourceTransformerException
protected void setAccessModifierAttributes(SourceElement columnElement)
columnElement
- the column element, not null.protected JavaType getFieldJavaType(SourceElement columnElement, SchemaType schemaType) throws SourceTransformerException
columnElement
- the column element, not null.schemaType
- the schema type, not null.
SourceTransformerException
protected void checkElementName(SourceElement columnElement)
columnElement
- the column element, not null.
IllegalArgumentException
- if the element name is wrong.protected void checkColumnNameExists(SourceElement columnElement) throws SourceTransformerException
columnElement
- the column element, not null.
SourceTransformerException
- if the name attribute does not exist.protected void setJavaNameAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setFieldNameAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setPeerColumnNameAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setQualifiedColumnNameAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setGetterNameAttribute(SourceElement columnElement, JavaType javaType, ControllerState controllerState)
columnElement
- the column element, not null.javaType
- the java type of the column, not null.controllerState
- the controller state, not null.protected void setSetterNameAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setPrimitiveTypeAttribute(SourceElement columnElement, JavaType javaType)
columnElement
- the column element, not null.javaType
- the type of the java field corresponding to the
column, not null.protected void setNumberTypeAttribute(SourceElement columnElement, JavaType javaType)
columnElement
- the column element, not null.javaType
- the type of the java field corresponding to the
column, not null.protected void setDefaultValueAttribute(SourceElement columnElement, JavaType javaType, ControllerState controllerState) throws SourceTransformerException
columnElement
- the column element, not null.javaType
- the type of the java field corresponding to the
column, not null.controllerState
- the ControllerState, not null.
SourceTransformerException
- if an unknown primitive type
is encounteredprotected String getDefaultValueWithDefaultSet(JavaType javaType, String defaultValue, boolean useDatabaseDefaultValue, SourceElement columnElement) throws SourceTransformerException
javaType
- The java type of the column.defaultValue
- The default value from the schema.useDatabaseDefaultValue
- whether the database default value should
be used.columnElement
- the current column element for which
the default value should be calculated.
SourceTransformerException
- if an illegal default value is used.public static Date getDefaultValueAsDate(String defaultValue) throws SourceTransformerException
defaultValue
- the String to parse.
SourceTransformerException
- if the date cannot be parsed.protected String getDefaultValueWithoutDefaultSet(JavaType javaType) throws SourceTransformerException
javaType
- The java type of the column.
SourceTransformerException
protected void setUseDatabaseDefaultValueAttribute(SourceElement columnElement)
columnElement
- the column element, not null.protected void setResultSetGetterAttribute(SourceElement columnElement, SchemaType schemaType)
columnElement
- the column element, not null.schemaType
- the schema type of the column, not null.protected void setSampleObjectAttribute(SourceElement columnElement, SchemaType schemaType)
columnElement
- the column element, not null.schemaType
- the schema type of the column, not null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |