Package liquibase.datatype
Class DataTypeFactory
- java.lang.Object
-
- liquibase.datatype.DataTypeFactory
-
public class DataTypeFactory extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDataTypeFactory()Build the factory registry from all classes in the classpath that implementLiquibaseDataType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LiquibaseDataTypefrom(DatabaseDataType type, Database database)LiquibaseDataTypefrom(DataType type, Database database)LiquibaseDataTypefromDescription(String dataTypeDefinition, Database database)Translates a column data type definition (e.g.LiquibaseDataTypefromObject(Object object, Database database)StringgetFalseBooleanValue(Database database)static DataTypeFactorygetInstance()Get this factory singletonStringgetTrueBooleanValue(Database database)voidregister(LiquibaseDataType type)Registers an implementation ofLiquibaseDataTypewith both its name and all aliases for the data type as a handler in the factory's registry.static voidreset()Discards the active factory and creates a new singleton instance.voidunregister(String name)Remove
-
-
-
Constructor Detail
-
DataTypeFactory
protected DataTypeFactory()
Build the factory registry from all classes in the classpath that implementLiquibaseDataType
-
-
Method Detail
-
getInstance
public static DataTypeFactory getInstance()
Get this factory singleton- Returns:
- a reference to this factory
-
reset
public static void reset()
Discards the active factory and creates a new singleton instance.
-
register
public void register(LiquibaseDataType type)
Registers an implementation ofLiquibaseDataTypewith both its name and all aliases for the data type as a handler in the factory's registry. Classes implement theLiquibaseDataType.getPriority(), which will cause the class with the highest priority to become the primary handler for the data type.- Parameters:
type- the implementation to register
-
unregister
public void unregister(String name)
Remove- Parameters:
name-
-
fromDescription
public LiquibaseDataType fromDescription(String dataTypeDefinition, Database database)
Translates a column data type definition (e.g. varchar(255), java.sql.Types.NVARCHAR(10), VARCHAR2(255 BYTE)... ) into a normalized data type in object form. Note that, due to variety of allowed ways to specify a data type (SQL-Standard, Java type, native RDBMS type...), the dataTypeDefinition we receive for processing may already be the native type for the target RDBMS.- Parameters:
dataTypeDefinition- the definition from the changeSetdatabase- theDatabaseobject from for which the native definition is to be generated- Returns:
- the corresponding Liquibase data type in object form.
-
fromObject
public LiquibaseDataType fromObject(Object object, Database database)
-
from
public LiquibaseDataType from(DataType type, Database database)
-
from
public LiquibaseDataType from(DatabaseDataType type, Database database)
-
-