Package liquibase.datatype
Class LiquibaseDataType
java.lang.Object
liquibase.datatype.LiquibaseDataType
- All Implemented Interfaces:
PrioritizedService
- Direct Known Subclasses:
BigIntType
,BinaryTypeSnowflake
,BlobType
,BooleanType
,CharType
,ClobType
,ClobTypeSnowflake
,CurrencyType
,DatabaseFunctionType
,DataTypeWrapper
,DateTimeType
,DateType
,DecimalType
,DoubleType
,FloatType
,IntType
,MediumIntType
,NumberType
,SmallIntType
,TextDataTypeSnowflake
,TimestampNTZTypeSnowflake
,TimeType
,TinyIntType
,UnknownType
,UUIDType
,XMLType
Object representing a data type, instead of a plain string. It will be returned by
the getXXXType in the Database interface.
-
Field Summary
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
Constructor Summary
ModifierConstructorDescriptionprotected
LiquibaseDataType
(String name, int minParameters, int maxParameters) protected
LiquibaseDataType
(LiquibaseDataType originalType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(Object value) Adds an object to the list of this data type's parameters.boolean
void
finishInitialization
(String originalDefinition) protected String
formatNumber
(String value) Removes any trailing ".0[...]0" from the end of a numberprotected String
functionToSql
(DatabaseFunction function, Database database) Returns additional information that was stored duringDataTypeFactory.fromDescription(String, Database)
or other parsers.String[]
abstract LoadDataChange.LOAD_DATA_TYPE
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
Obtains the "raw" data type definition if one was used to create this object as a result of parsingint
hashCode()
boolean
protected boolean
isCurrentDateTimeFunction
(String string, Database database) Determines if the given function name refers to the function that returns the current time and date for a specific DBMS.protected String
numberToSql
(Number number, Database database) objectToSql
(Object value, Database database) Returns the value object in a format to include in SQL.protected String
otherToSql
(Object value, Database database) void
setAdditionalInformation
(String additionalInformation) sqlToObject
(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.
-
Constructor Details
-
LiquibaseDataType
-
LiquibaseDataType
public LiquibaseDataType() -
LiquibaseDataType
-
-
Method Details
-
getName
-
getAliases
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfacePrioritizedService
-
supports
-
getMinParameters
-
getMaxParameters
-
getParameters
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.- Returns:
- An array with the parameters. May contain 0 items.
-
addParameter
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 untilvalidate(Database)
is called, because the number of allowed parameters might differ between DBMS.- Parameters:
value
- the new value to add as parameter.
-
getAdditionalInformation
Returns additional information that was stored duringDataTypeFactory.fromDescription(String, Database)
or other parsers.- Returns:
- the additional information. Might be null.
-
setAdditionalInformation
-
getRawDefinition
Obtains the "raw" data type definition if one was used to create this object as a result of parsing- Returns:
- the raw definition, or null.
-
validate
Validates the correct state of this data type against a given database.- 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
Transforms this data type into the native data type of the target DBMS.- Parameters:
database
- theDatabase
for which the native data type is to be constructed- Returns:
- the new, native data type
-
objectToSql
Returns the value object in a format to include in SQL. Quote if necessary. -
functionToSql
-
numberToSql
-
otherToSql
-
sqlToObject
-
toString
-
equals
-
hashCode
public int hashCode() -
isCurrentDateTimeFunction
Determines if the given function name refers to the function that returns the current time and date for a specific DBMS. Also returns true if the name returns the Liquibase wildcard CURRENT_DATE_TIME_PLACE_HOLDER, which will later be translated into the appropriate function.- Parameters:
string
- The database function name to testdatabase
- A database object to test against- Returns:
- see above
-
finishInitialization
-
formatNumber
Removes any trailing ".0[...]0" from the end of a number- Parameters:
value
- the number (in String form) to format- Returns:
- the formatted number
-
getLoadTypeName
Returns one of the four basic data types for use in LoadData: BOOLEAN, NUMERIC, DATE or STRING- Returns:
- one of the above Strings
-
isAutoIncrement
public boolean isAutoIncrement()
-