Class SchemaTypeHelper
- java.lang.Object
-
- 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 1856067 2019-03-22 15:32:47Z gk $
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SqlType
getDomain(SourceElement columnElement, ControllerState controllerState)
static SqlType
getDomain(Column column, ControllerState controllerState)
static SchemaType
getSchemaType(SourceElement columnElement, ControllerState controllerState)
Determines the schema type of a column.static SchemaType
getSchemaType(Column column, 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.
-
-
-
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.
-
getSchemaType
public static SchemaType getSchemaType(Column column, ControllerState controllerState) throws SourceTransformerException
Determines the schema type of a column.- Parameters:
column
- 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
-
getDomain
public static SqlType getDomain(Column column, ControllerState controllerState) throws SourceTransformerException
- Throws:
SourceTransformerException
-
-