Class MigrationUtilities


  • @Service(MigrationUtilities.class)
    public class MigrationUtilities
    extends Object
    Utility methods to match columns for migration.
    May be replaced by project specific migration rules via @Service.
    • Constructor Detail

      • MigrationUtilities

        public MigrationUtilities()
    • Method Detail

      • getInstance

        public static MigrationUtilities getInstance()
        The singleton.
        Returns:
        the singleton
      • isVowel

        public boolean isVowel​(char c)
        Returns whether the character should be treated as a vowel.
        Parameters:
        c - the character
        Returns:
        true if vowel
      • containsVowel

        public boolean containsVowel​(String s)
        Returns whether the given string contains at least one vowel.
        Parameters:
        s - the string
        Returns:
        true if vowels found
      • extractSyllables

        public List<String> extractSyllables​(String name)
        Extracts the syllables of a name.
        The default implementation is very simple, but works good enough for the purpose of column migration.
        Parameters:
        name - the column name
        Returns:
        the syllables
      • bestMatch

        public String bestMatch​(String modelName,
                                List<String> existingNames)
        Finds the best match for a given model name among existing names.
        Parameters:
        modelName - the new name according to the model
        existingNames - the existing column names in the database table
        Returns:
        the best match, null if existingnames is empty