java.lang.Object
org.tentackle.model.ModelUtilities
Model utility methods.
May be replaced by project specific implementation via
May be replaced by project specific implementation via
@Service
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFinds the best match for a given model name among existing names.boolean
Returns whether the given string contains at least one vowel.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 ModelUtilities
The singleton.protected boolean
isJoinedLetter
(char c1, char c2) Returns whether two character can be regarded as one.boolean
isVowel
(char c) Returns whether the character should be treated as a vowel.
-
Constructor Details
-
ModelUtilities
public ModelUtilities()Creates the model utilities.
-
-
Method Details
-
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
Returns whether the given string contains at least one vowel.- Parameters:
s
- the string- Returns:
- true if vowels found
-
extractSyllables
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
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
-
isJoinedLetter
protected boolean isJoinedLetter(char c1, char c2) Returns whether two character can be regarded as one.- Parameters:
c1
- the first charc2
- the second char- Returns:
- true if treat as single char
-