Klasse OMColumnJavaTransformer

java.lang.Object
org.apache.torque.templates.transformer.om.OMColumnJavaTransformer

public class OMColumnJavaTransformer extends Object
Does java related mappings.
  • Konstruktordetails

    • OMColumnJavaTransformer

      public OMColumnJavaTransformer()
  • Methodendetails

    • setJavaTypeAttribute

      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.
      Parameter:
      columnElement - the column element, not null.
    • setJavaNameAttribute

      protected void setJavaNameAttribute(SourceElement columnElement)
      Sets the javaName attribute of the column element if it is not already set.
      Parameter:
      columnElement - the column element, not null.
    • setFieldNameAttribute

      protected void setFieldNameAttribute(SourceElement columnElement)
      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

      public static Date getDefaultValueAsDate(String defaultValue) throws SourceTransformerException
      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 element enum-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