liquibase.database.typeconversion.core
Class AbstractTypeConverter

java.lang.Object
  extended by liquibase.database.typeconversion.core.AbstractTypeConverter
All Implemented Interfaces:
TypeConverter, PrioritizedService
Direct Known Subclasses:
CacheTypeConverter, DB2TypeConverter, DefaultTypeConverter, DerbyTypeConverter, FirebirdTypeConverter, H2TypeConverter, HsqlTypeConverter, InformixTypeConverter, MaxDBTypeConverter, MSSQLTypeConverter, MySQLTypeConverter, OracleTypeConverter, PostgresTypeConverter, SQLiteTypeConverter, SybaseASATypeConverter, SybaseTypeConverter

public abstract class AbstractTypeConverter
extends Object
implements TypeConverter


Field Summary
 
Fields inherited from interface liquibase.servicelocator.PrioritizedService
PRIORITY_DATABASE, PRIORITY_DEFAULT
 
Constructor Summary
AbstractTypeConverter()
           
 
Method Summary
protected  void addPrecisionToType(String precision, DataType returnTypeName)
           
 Object convertDatabaseValueToObject(Object value, int databaseDataType, int firstParameter, int secondParameter, Database database)
           
protected  Object convertToCorrectObjectType(String value, int dataType, int columnSize, int decimalDigits, Database database)
           
 String convertToDatabaseTypeString(Column referenceColumn, Database database)
           
 BigIntType getBigIntType()
           
 BlobType getBlobType()
           
 BooleanType getBooleanType()
           
 CharType getCharType()
          Returns the actual database-specific data type to use for a "char" column.
 ClobType getClobType()
           
 CurrencyType getCurrencyType()
           
 DataType getDataType(ColumnConfig columnConfig)
           
 DataType getDataType(Object object)
           
 DataType getDataType(String columnTypeString, Boolean autoIncrement)
          Returns the database-specific datatype for the given column configuration.
protected  DataType getDataType(String columnTypeString, Boolean autoIncrement, String dataTypeName, String precision, String additionalInformation)
           
 DateTimeType getDateTimeType()
           
 DateType getDateType()
          Returns the actual database-specific data type to use a "date" (no time information) column.
 DoubleType getDoubleType()
          Returns the actual database-specific data type to use for a "double" column.
 FloatType getFloatType()
          Returns the actual database-specific data type to use for a "float" column.
 IntType getIntType()
          Returns the actual database-specific data type to use for a "int" column.
 BlobType getLongBlobType()
           
 NumberType getNumberType()
           
 NVarcharType getNVarcharType()
          Returns the actual database-specific data type to use for a "varchar" column.
 SmallIntType getSmallIntType()
           
 TextType getTextType()
           
 TimeType getTimeType()
          Returns the actual database-specific data type to use a "time" column.
 TinyIntType getTinyIntType()
          Returns the actual database-specific data type to use for a "tinyint" column.
 UUIDType getUUIDType()
           
 VarcharType getVarcharType()
          Returns the actual database-specific data type to use for a "varchar" column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface liquibase.database.typeconversion.TypeConverter
getPriority, supports
 

Constructor Detail

AbstractTypeConverter

public AbstractTypeConverter()
Method Detail

convertDatabaseValueToObject

public Object convertDatabaseValueToObject(Object value,
                                           int databaseDataType,
                                           int firstParameter,
                                           int secondParameter,
                                           Database database)
                                    throws ParseException
Specified by:
convertDatabaseValueToObject in interface TypeConverter
Throws:
ParseException

getDataType

public DataType getDataType(Object object)
Specified by:
getDataType in interface TypeConverter

convertToCorrectObjectType

protected Object convertToCorrectObjectType(String value,
                                            int dataType,
                                            int columnSize,
                                            int decimalDigits,
                                            Database database)
                                     throws ParseException
Throws:
ParseException

getDataType

public DataType getDataType(String columnTypeString,
                            Boolean autoIncrement)
Returns the database-specific datatype for the given column configuration. This method will convert some generic column types (e.g. boolean, currency) to the correct type for the current database.

Specified by:
getDataType in interface TypeConverter

getDataType

protected DataType getDataType(String columnTypeString,
                               Boolean autoIncrement,
                               String dataTypeName,
                               String precision,
                               String additionalInformation)

addPrecisionToType

protected void addPrecisionToType(String precision,
                                  DataType returnTypeName)
                           throws NumberFormatException
Throws:
NumberFormatException

getDataType

public DataType getDataType(ColumnConfig columnConfig)
Specified by:
getDataType in interface TypeConverter

getDateType

public DateType getDateType()
Returns the actual database-specific data type to use a "date" (no time information) column.

Specified by:
getDateType in interface TypeConverter

getTimeType

public TimeType getTimeType()
Returns the actual database-specific data type to use a "time" column.

Specified by:
getTimeType in interface TypeConverter

getDateTimeType

public DateTimeType getDateTimeType()
Specified by:
getDateTimeType in interface TypeConverter

getBigIntType

public BigIntType getBigIntType()
Specified by:
getBigIntType in interface TypeConverter

getCharType

public CharType getCharType()
Returns the actual database-specific data type to use for a "char" column.

Specified by:
getCharType in interface TypeConverter

getVarcharType

public VarcharType getVarcharType()
Returns the actual database-specific data type to use for a "varchar" column.

Specified by:
getVarcharType in interface TypeConverter

getNVarcharType

public NVarcharType getNVarcharType()
Returns the actual database-specific data type to use for a "varchar" column.


getFloatType

public FloatType getFloatType()
Returns the actual database-specific data type to use for a "float" column.

Specified by:
getFloatType in interface TypeConverter
Returns:
database-specific type for float

getDoubleType

public DoubleType getDoubleType()
Returns the actual database-specific data type to use for a "double" column.

Specified by:
getDoubleType in interface TypeConverter
Returns:
database-specific type for double

getIntType

public IntType getIntType()
Returns the actual database-specific data type to use for a "int" column.

Specified by:
getIntType in interface TypeConverter
Returns:
database-specific type for int

getTinyIntType

public TinyIntType getTinyIntType()
Returns the actual database-specific data type to use for a "tinyint" column.

Specified by:
getTinyIntType in interface TypeConverter
Returns:
database-specific type for tinyint

getSmallIntType

public SmallIntType getSmallIntType()

getBooleanType

public BooleanType getBooleanType()
Specified by:
getBooleanType in interface TypeConverter

getNumberType

public NumberType getNumberType()

getCurrencyType

public CurrencyType getCurrencyType()
Specified by:
getCurrencyType in interface TypeConverter

getUUIDType

public UUIDType getUUIDType()
Specified by:
getUUIDType in interface TypeConverter

getTextType

public TextType getTextType()
Specified by:
getTextType in interface TypeConverter

getClobType

public ClobType getClobType()
Specified by:
getClobType in interface TypeConverter

getBlobType

public BlobType getBlobType()
Specified by:
getBlobType in interface TypeConverter

getLongBlobType

public BlobType getLongBlobType()
Specified by:
getLongBlobType in interface TypeConverter

convertToDatabaseTypeString

public String convertToDatabaseTypeString(Column referenceColumn,
                                          Database database)
Specified by:
convertToDatabaseTypeString in interface TypeConverter


Copyright © 2012 Liquibase.org. All Rights Reserved.