Class LiquibaseDataType

    • Constructor Detail

      • LiquibaseDataType

        public LiquibaseDataType()
      • LiquibaseDataType

        protected LiquibaseDataType​(String name,
                                    int minParameters,
                                    int maxParameters)
    • Method Detail

      • getName

        public String getName()
      • getAliases

        public String[] getAliases()
      • supports

        public boolean supports​(Database database)
      • getMinParameters

        public int getMinParameters​(Database database)
      • getMaxParameters

        public int getMaxParameters​(Database database)
      • getParameters

        public Object[] 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

        public void addParameter​(Object value)
        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 until validate(Database) is called, because the number of allowed parameters might differ between DBMS.
        Parameters:
        value - the new value to add as parameter.
      • setAdditionalInformation

        public void setAdditionalInformation​(String additionalInformation)
      • getRawDefinition

        public String 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

        public boolean validate​(Database database)
        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

        public DatabaseDataType toDatabaseDataType​(Database database)
        Transforms this data type into the native data type of the target DBMS.
        Parameters:
        database - the Database for which the native data type is to be constructed
        Returns:
        the new, native data type
      • objectToSql

        public String objectToSql​(Object value,
                                  Database database)
        Returns the value object in a format to include in SQL. Quote if necessary.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isCurrentDateTimeFunction

        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. 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 test
        database - A database object to test against
        Returns:
        see above
      • finishInitialization

        public void finishInitialization​(String originalDefinition)
      • formatNumber

        protected String formatNumber​(String value)
        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

        public abstract LoadDataChange.LOAD_DATA_TYPE 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()