Package liquibase.datatype
Class DataTypeFactory
- java.lang.Object
-
- liquibase.datatype.DataTypeFactory
-
public class DataTypeFactory extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataTypeFactory()
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 LiquibaseDataType
from(DatabaseDataType type, Database database)
LiquibaseDataType
from(DataType type, Database database)
LiquibaseDataType
fromDescription(String dataTypeDefinition, Database database)
Translates a column data type definition (e.g.LiquibaseDataType
fromObject(Object object, Database database)
String
getFalseBooleanValue(Database database)
static DataTypeFactory
getInstance()
Get this factory singletonString
getTrueBooleanValue(Database database)
void
register(LiquibaseDataType type)
Registers an implementation ofLiquibaseDataType
with both its name and all aliases for the data type as a handler in the factory's registry.static void
reset()
Discards the active factory and creates a new singleton instance.void
unregister(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 ofLiquibaseDataType
with 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
- theDatabase
object 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)
-
-