Package liquibase.common.datatype
Class DataTypeWrapper
- java.lang.Object
-
- liquibase.datatype.LiquibaseDataType
-
- liquibase.common.datatype.DataTypeWrapper
-
- All Implemented Interfaces:
PrioritizedService
public class DataTypeWrapper extends LiquibaseDataType
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
Constructors Constructor Description DataTypeWrapper(LiquibaseDataType originalType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(Object value)Adds an object to the list of this data type's parameters.booleanequals(Object o)String[]getAliases()LoadDataChange.LOAD_DATA_TYPEgetLoadTypeName()Returns one of the four basic data types for use in LoadData: BOOLEAN, NUMERIC, DATE or STRINGintgetMaxParameters(Database database)intgetMinParameters(Database database)StringgetName()Object[]getParameters()Returns an array with the parameters to the data type, e.g.intgetPriority()LiquibaseDataTypegetUnderlyingDataType()inthashCode()StringobjectToSql(Object value, Database database)Returns the value object in a format to include in SQL.ObjectstringToObject(String value, Database database)booleansupports(Database database)DatabaseDataTypetoDatabaseDataType(Database database)Transforms this data type into the native data type of the target DBMS.StringtoString()booleanvalidate(Database database)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 Detail
-
DataTypeWrapper
public DataTypeWrapper(LiquibaseDataType originalType)
-
-
Method Detail
-
getUnderlyingDataType
public LiquibaseDataType getUnderlyingDataType()
-
getName
public String getName()
- Overrides:
getNamein classLiquibaseDataType
-
getAliases
public String[] getAliases()
- Overrides:
getAliasesin classLiquibaseDataType
-
getPriority
public int getPriority()
- Specified by:
getPriorityin interfacePrioritizedService- Overrides:
getPriorityin classLiquibaseDataType
-
supports
public boolean supports(Database database)
- Overrides:
supportsin classLiquibaseDataType
-
getMinParameters
public int getMinParameters(Database database)
- Overrides:
getMinParametersin classLiquibaseDataType
-
getMaxParameters
public int getMaxParameters(Database database)
- Overrides:
getMaxParametersin classLiquibaseDataType
-
getParameters
public Object[] getParameters()
Description copied from class:LiquibaseDataTypeReturns 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:
getParametersin classLiquibaseDataType- Returns:
- An array with the parameters. May contain 0 items.
-
addParameter
public void addParameter(Object value)
Description copied from class:LiquibaseDataTypeAdds 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:
addParameterin classLiquibaseDataType- Parameters:
value- the new value to add as parameter.
-
validate
public boolean validate(Database database)
Description copied from class:LiquibaseDataTypeValidates the correct state of this data type against a given database.- Overrides:
validatein 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
public DatabaseDataType toDatabaseDataType(Database database)
Description copied from class:LiquibaseDataTypeTransforms this data type into the native data type of the target DBMS.- Overrides:
toDatabaseDataTypein classLiquibaseDataType- Parameters:
database- theDatabasefor which the native data type is to be constructed- Returns:
- the new, native data type
-
objectToSql
public String objectToSql(Object value, Database database)
Description copied from class:LiquibaseDataTypeReturns the value object in a format to include in SQL. Quote if necessary.- Overrides:
objectToSqlin classLiquibaseDataType
-
toString
public String toString()
- Overrides:
toStringin classLiquibaseDataType
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classLiquibaseDataType
-
hashCode
public int hashCode()
- Overrides:
hashCodein classLiquibaseDataType
-
getLoadTypeName
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName()
Description copied from class:LiquibaseDataTypeReturns one of the four basic data types for use in LoadData: BOOLEAN, NUMERIC, DATE or STRING- Specified by:
getLoadTypeNamein classLiquibaseDataType- Returns:
- one of the above Strings
-
-