Class DataTypeFactory


  • public class DataTypeFactory
    extends Object
    • Constructor Detail

      • DataTypeFactory

        protected DataTypeFactory()
        Build the factory registry from all classes in the classpath that implement LiquibaseDataType
    • 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 of LiquibaseDataType with both its name and all aliases for the data type as a handler in the factory's registry. Classes implement the LiquibaseDataType.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 changeSet
        database - the Database object from for which the native definition is to be generated
        Returns:
        the corresponding Liquibase data type in object form.
      • getTrueBooleanValue

        public String getTrueBooleanValue​(Database database)
      • getFalseBooleanValue

        public String getFalseBooleanValue​(Database database)