Klasse OMColumnJavaTransformer
java.lang.Object
org.apache.torque.templates.transformer.om.OMColumnJavaTransformer
Does java related mappings.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic 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.static String
setEnumAttributes
(SourceElement columnElement, ControllerState controllerState) Sets the enumClassName, enumPackage and generateEnum Attributes if either enumValue child elements (xml elementenum-value
) are present or the enumType attribute is set on the column.protected void
setEnumValueJavaNameAttribute
(SourceElement enumValueElement) protected void
setEnumValueJavaValueAttribute
(SourceElement enumValueElement, JavaType columnJavaType) protected JavaType
setFieldJavaType
(SourceElement columnElement, SchemaType schemaType, String enumClassName) Returns the java type of the field representing a database column.protected void
setFieldNameAttribute
(SourceElement columnElement) Sets the fieldName 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.
-
Konstruktordetails
-
OMColumnJavaTransformer
public OMColumnJavaTransformer()
-
-
Methodendetails
-
setJavaTypeAttribute
Sets the javaType attribute of the column element if it is not already set and a default value is set.- Parameter:
columnElement
- the column element, not null.
-
setJavaNameAttribute
Sets the javaName attribute of the column element if it is not already set.- Parameter:
columnElement
- the column element, not null.
-
setFieldNameAttribute
Sets the fieldName attribute of the column element if it is not already set. The javaName attribute of the column must be set.- Parameter:
columnElement
- the column element, not null.
-
getDefaultValueWithDefaultSet
protected String getDefaultValueWithDefaultSet(JavaType javaType, String defaultValue, boolean useDatabaseDefaultValue, SourceElement columnElement) throws SourceTransformerException Calculates the java default value of a column in case a default value is set.- Parameter:
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.- Gibt zurück:
- The java default value.
- Löst aus:
SourceTransformerException
- if an illegal default value is used.
-
getDefaultValueAsDate
Parses the default value String as Date.- Parameter:
defaultValue
- the String to parse.- Gibt zurück:
- the parsed date.
- Löst aus:
SourceTransformerException
- if the date cannot be parsed.
-
getDefaultValueWithoutDefaultSet
protected String getDefaultValueWithoutDefaultSet(JavaType javaType) throws SourceTransformerException Calculates the java default value of a column in case a default value is not set.- Parameter:
javaType
- The java type of the column.- Gibt zurück:
- The java default value.
- Löst aus:
SourceTransformerException
- if the value cannot be found
-
setFieldJavaType
protected JavaType setFieldJavaType(SourceElement columnElement, SchemaType schemaType, String enumClassName) throws SourceTransformerException Returns the java type of the field representing a database column.- Parameter:
columnElement
- the column element, not null.schemaType
- the schema type, not null.enumClassName
- the class name of the enum, or null if the column is not an enum.- Gibt zurück:
- the java type of the column
- Löst aus:
SourceTransformerException
- if error in transform
-
setEnumAttributes
public static String setEnumAttributes(SourceElement columnElement, ControllerState controllerState) Sets the enumClassName, enumPackage and generateEnum Attributes if either enumValue child elements (xml elementenum-value
) are present or the enumType attribute is set on the column. Afterwards, the enumClassName attribute contains the unqualified name of the enum, the enumPackage attribute contains the enum package, and the generateEnum attribute contains "true" if the enum needs to be generated. This requires that the javaName attribute is set on the column and that the dbObjectPackage element is set on the table.- Parameter:
columnElement
- the column element to set the elements in, not null.controllerState
- the controller state, not null.- Gibt zurück:
- the class name of the enum, or null if the column is not an enum column.
-
setEnumValueJavaNameAttribute
protected void setEnumValueJavaNameAttribute(SourceElement enumValueElement) throws SourceTransformerException - Löst aus:
SourceTransformerException
-
setEnumValueJavaValueAttribute
protected void setEnumValueJavaValueAttribute(SourceElement enumValueElement, JavaType columnJavaType) throws SourceTransformerException - Löst aus:
SourceTransformerException
-