Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.torque.templates.typemapping
Class SqlType

    java.lang.Object
      org.apache.torque.templates.typemapping.SqlType

Direct Known Subclasses:
  SizedForBitDataSqlType

    public class SqlType

extends Object

The SQL type data for a column. Can contain additional information such as default size, scale and defaultValue. This class is immutable.

Version:
  $Id: SqlType.java 1436342 2013-01-21 13:40:05Z tfischer $

Constructor Summary
`SqlType(SqlType sqlType, String size, String scale, String defaultValue)` Creates a new SqlType by copying another sql type.
`SqlType(String sqlTypeName)` Creates a new SqlType with the given SQL Type.
`SqlType(String sqlTypeName, String size)` Creates a new SqlType with null scale and null default value.
`SqlType(String sqlTypeName, String size, String scale)` Creates a new SqlType with null default value.
`SqlType(String sqlTypeName, String size, String scale, String defaultValue)` Creates a new SqlType.

Method Summary
`String` | `getDefaultValue()`
`SqlType` | `getNew(String size, String scale, String defaultValue)` Returns a new instance with the given sqlTypeName, size, scale and default value.
`String` | `getScale()`
`String` | `getSize()`
`String` | `getSqlTypeName()` Returns the SQL type name.
`String` | `printSize(String sizeSuffix)` Return the size and scale in brackets for use in an SQL script.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SqlType

    public SqlType(String sqlTypeName)

  Creates a new SqlType with the given SQL Type. Size, scale and defaultValue are set to null.

  Parameters:
    `sqlType` - the SQL name of the SQL type, or null.

### SqlType

    public SqlType(String sqlTypeName,
                   String size)

  Creates a new SqlType with null scale and null default value.

  Parameters:
    `sqlTypeName` - the SQL name of the SQL type, not null.
    `size` - the default size of the columns with this SQL type. Can be overridden in the column definition.
  Throws:
    `NullPointerException` - if sqlTypeName is null.

### SqlType

    public SqlType(String sqlTypeName,
                   String size,
                   String scale)

  Creates a new SqlType with null default value.

  Parameters:
    `sqlTypeName` - the SQL name of the SQL type, not null.
    `size` - the default size of the columns with this SQL type. Can be overridden in the column definition.
    `scale` - the default scale of the columns with this SQL type. Can be overridden in the column definition.
  Throws:
    `NullPointerException` - if sqlTypeName is null.

### SqlType

    public SqlType(String sqlTypeName,
                   String size,
                   String scale,
                   String defaultValue)

  Creates a new SqlType.

  Parameters:
    `sqlTypeName` - the SQL name of the SQL type, not null.
    `size` - the default size of the columns with this SQL type. Can be overridden in the column definition.
    `scale` - the default scale of the columns with this SQL type. Can be overridden in the column definition.
    `defaultValue` - the default "default value" of the columns with this SQL type. Can be overridden in the column definition.
  Throws:
    `NullPointerException` - if sqlTypeName is null.

### SqlType

    public SqlType(SqlType sqlType,
                   String size,
                   String scale,
                   String defaultValue)

  Creates a new SqlType by copying another sql type.

  Parameters:
    `sqlType` - the SQL type, to copy, not null.
    `size` - the default size of the columns with this SQL type.
    `scale` - the default scale of the columns with this SQL type. ´´ * @param defaultValue the default "default value" of the columns with this SQL type.
  Throws:
    `NullPointerException` - if sqlType is null.

Method Detail

### getScale

    public String getScale()

  Returns:
    Returns the scale.

### getSize

    public String getSize()

  Returns:
    Returns the size.

### getDefaultValue

    public String getDefaultValue()

  Returns:
    Returns the defaultValue.

### getSqlTypeName

    public String getSqlTypeName()

  Returns the SQL type name.

  Returns:
    The SQL type name for this column type, or null if the type is not set.

### printSize

    public String printSize(String sizeSuffix)

  Return the size and scale in brackets for use in an SQL script.

  Returns:
    size and scale or an empty String if there are no values available.

### getNew

    public SqlType getNew(String size,
                          String scale,
                          String defaultValue)

  Returns a new instance with the given sqlTypeName, size, scale and default value.

  Returns:
    a new instance with the given parameters.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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