org.apache.torque.templates.transformer
Class SchemaTypeHelper

java.lang.Object
  extended by org.apache.torque.templates.transformer.SchemaTypeHelper

public final class SchemaTypeHelper
extends Object

Helper class for retrieving the schema type of a column. $Id: SchemaTypeHelper.java 1436342 2013-01-21 13:40:05Z tfischer $


Method Summary
static SqlType getDomain(SourceElement columnElement, ControllerState controllerState)
           
static SchemaType getSchemaType(SourceElement columnElement, ControllerState controllerState)
          Determines the schema type of a column.
static SqlType getSqlType(SchemaType schemaType, SqlType domainType, ControllerState controllerState, String size, String scale, String defaultValue)
          Returns the SQL type for a schema type and the specified target database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSchemaType

public static SchemaType getSchemaType(SourceElement columnElement,
                                       ControllerState controllerState)
                                throws SourceTransformerException
Determines the schema type of a column.

Parameters:
columnElement - the source element which defines the column for which the schema type should be determined; not null.
controllerState - the controller state, not null.
Returns:
the schema type of the column, not null.
Throws:
SourceTransformerException - if the name attribute is not set in the column or if the type refers to an unknown type.

getSqlType

public static SqlType getSqlType(SchemaType schemaType,
                                 SqlType domainType,
                                 ControllerState controllerState,
                                 String size,
                                 String scale,
                                 String defaultValue)
Returns the SQL type for a schema type and the specified target database.

Parameters:
schemaType - the schema type for which the SQL type should be determined, not null.
domainType - the domain type which overrides the schema type, or null if no domain is defined.
controllerState - the controller state, not null.
size - overrides the size from schemaType and/or domainType, or null to use the default from domainType or schemaType.
scale - overrides the scale from schemaType and/or domainType, or null to use the default from domainType or schemaType.
defaultValue - overrides the defaultValue from schemaType and/or domainType, or null to use the default from domainType or schemaType.
Returns:
the the SQL type for the schema type, or null if no SQL type exists for the schema type.

getDomain

public static SqlType getDomain(SourceElement columnElement,
                                ControllerState controllerState)
                         throws SourceTransformerException
Throws:
SourceTransformerException


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.