Package liquibase.common.datatype
Class DataTypeWrapper
java.lang.Object
liquibase.datatype.LiquibaseDataType
liquibase.common.datatype.DataTypeWrapper
- All Implemented Interfaces:
PrioritizedService
A wrapper class for data types.
Wraps a LiquibaseDataType instance and replaces some of the
original data types with dbms-compatible ones.
-
Field Summary
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(Object value) Adds an object to the list of this data type's parameters.boolean
String[]
Returns one of the four basic data types for use in LoadData: BOOLEAN, NUMERIC, DATE or STRINGint
getMaxParameters
(Database database) int
getMinParameters
(Database database) getName()
Object[]
Returns an array with the parameters to the data type, e.g.int
int
hashCode()
objectToSql
(Object value, Database database) Returns the value object in a format to include in SQL.stringToObject
(String value, Database database) boolean
toDatabaseDataType
(Database database) Transforms this data type into the native data type of the target DBMS.toString()
boolean
Validates the correct state of this data type against a given database.Methods inherited from class liquibase.datatype.LiquibaseDataType
finishInitialization, formatNumber, functionToSql, getAdditionalInformation, getRawDefinition, isAutoIncrement, isCurrentDateTimeFunction, numberToSql, otherToSql, setAdditionalInformation, sqlToObject
-
Constructor Details
-
DataTypeWrapper
-
-
Method Details
-
getUnderlyingDataType
-
getName
- Overrides:
getName
in classLiquibaseDataType
-
getAliases
- Overrides:
getAliases
in classLiquibaseDataType
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfacePrioritizedService
- Overrides:
getPriority
in classLiquibaseDataType
-
supports
- Overrides:
supports
in classLiquibaseDataType
-
getMinParameters
- Overrides:
getMinParameters
in classLiquibaseDataType
-
getMaxParameters
- Overrides:
getMaxParameters
in classLiquibaseDataType
-
getParameters
Description copied from class:LiquibaseDataType
Returns an array with the parameters to the data type, e.g. NUMBER(10, 2) would return an array with the items 10 and 2.- Overrides:
getParameters
in classLiquibaseDataType
- Returns:
- An array with the parameters. May contain 0 items.
-
addParameter
Description copied from class:LiquibaseDataType
Adds an object to the list of this data type's parameters. Note that it is possible to temporarily exceed the allowed number of allowed parameters untilLiquibaseDataType.validate(Database)
is called, because the number of allowed parameters might differ between DBMS.- Overrides:
addParameter
in classLiquibaseDataType
- Parameters:
value
- the new value to add as parameter.
-
validate
Description copied from class:LiquibaseDataType
Validates the correct state of this data type against a given database.- Overrides:
validate
in classLiquibaseDataType
- Parameters:
database
- the database to validate against- Returns:
- true if the current settings for this data type can be implemented on the given database, false otherwise
-
toDatabaseDataType
Description copied from class:LiquibaseDataType
Transforms this data type into the native data type of the target DBMS.- Overrides:
toDatabaseDataType
in classLiquibaseDataType
- Parameters:
database
- theDatabase
for which the native data type is to be constructed- Returns:
- the new, native data type
-
objectToSql
Description copied from class:LiquibaseDataType
Returns the value object in a format to include in SQL. Quote if necessary.- Overrides:
objectToSql
in classLiquibaseDataType
-
stringToObject
-
toString
- Overrides:
toString
in classLiquibaseDataType
-
equals
- Overrides:
equals
in classLiquibaseDataType
-
hashCode
public int hashCode()- Overrides:
hashCode
in classLiquibaseDataType
-
getLoadTypeName
Description copied from class:LiquibaseDataType
Returns one of the four basic data types for use in LoadData: BOOLEAN, NUMERIC, DATE or STRING- Specified by:
getLoadTypeName
in classLiquibaseDataType
- Returns:
- one of the above Strings
-