- java.lang.Object
-
- org.tentackle.model.migrate.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 Summary
Constructors Constructor Description MigrationUtilities()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbestMatch(String modelName, List<String> existingNames)Finds the best match for a given model name among existing names.booleancontainsVowel(String s)Returns whether the given string contains at least one vowel.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.static MigrationUtilitiesgetInstance()The singleton.booleanisVowel(char c)Returns whether the character should be treated as a vowel.
-
-
-
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 modelexistingNames- the existing column names in the database table- Returns:
- the best match, null if existingnames is empty
-
-