Class Normalizer
- java.lang.Object
-
- org.apache.openjpa.jdbc.identifier.Normalizer
-
public class Normalizer extends Object
Static utility class used for operating on string based identifiers.
-
-
Constructor Summary
Constructors Constructor Description Normalizer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
append(String name1, String name2)
Appends one string to another using default identifier rules.static boolean
canSplit(String name)
Determines whether a name can be split into multiple components.static boolean
canSplit(String name, String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.static String
combine(String... names)
Combines multiple names using default identifier rules.static String
combine(String name1, String name2)
Combines two names using default identifier rules.static String
convert(IdentifierConfiguration config, String rule, String name)
Convert a normalized name to a name using the specified configuration and naming rule.static String
delimit(String name, boolean force)
Delimits a string if necessary, optionally forcing it to be delimited.static boolean
fullNamesEqual(String name1, String name2)
Splits names into individual components and compares individually for equalitystatic IdentifierConfiguration
getNamingConfiguration()
static boolean
isDelimited(String name)
Returns true if the name is delimited with default delimitersstatic String
joinNames(String[] names)
Joins multiple names using default identifier rules.static String
joinNames(String[] names, String delimiter)
Joins multiple names using the specified delimiter.static String
joinNames(String name1, String name2)
Joins two names using the default identifier rules.static boolean
namesEqual(String name1, String name2)
Compares two string names for equality.static String
normalizeMulti(String name)
Normalizes a multi-part namestatic String
normalizeString(String name)
Normalizes a single part namestatic String
normalizeUpper(String name)
Normalizes a name, if not delimited, converts to uppercase.static String
removeDelimiters(String name)
Removes default delimiters from a string.static String
removeHungarianNotation(String name)
Removes Hungarian notation from a string.static String[]
splitName(String name)
Splits a name into normalized componentsstatic String[]
splitName(String name, String delim)
Splits a name into normalized components using the specified name delimiter (ex. schema:table, delim = : --> { schema, table }static String
truncate(String name, int length)
Truncates a name to the specified length while maintaining delimiters.
-
-
-
Method Detail
-
getNamingConfiguration
public static IdentifierConfiguration getNamingConfiguration()
-
normalizeMulti
public static String normalizeMulti(String name)
Normalizes a multi-part name- Parameters:
name
-
-
normalizeString
public static String normalizeString(String name)
Normalizes a single part name- Parameters:
name
-
-
isDelimited
public static boolean isDelimited(String name)
Returns true if the name is delimited with default delimiters- Parameters:
name
-
-
fullNamesEqual
public static boolean fullNamesEqual(String name1, String name2)
Splits names into individual components and compares individually for equality- Parameters:
name1
-name2
-
-
namesEqual
public static boolean namesEqual(String name1, String name2)
Compares two string names for equality. If delimited, does a case comparison. If not delimited, does a case insensitive comparison.- Parameters:
name1
-name2
-
-
normalizeUpper
public static String normalizeUpper(String name)
Normalizes a name, if not delimited, converts to uppercase.- Parameters:
name
-
-
splitName
public static String[] splitName(String name)
Splits a name into normalized components- Parameters:
name
-
-
splitName
public static String[] splitName(String name, String delim)
Splits a name into normalized components using the specified name delimiter (ex. schema:table, delim = : --> { schema, table }- Parameters:
name
-
-
joinNames
public static String joinNames(String[] names)
Joins multiple names using default identifier rules.- Parameters:
names
-
-
joinNames
public static String joinNames(String[] names, String delimiter)
Joins multiple names using the specified delimiter.- Parameters:
names
-
-
joinNames
public static String joinNames(String name1, String name2)
Joins two names using the default identifier rules.- Parameters:
names
-
-
truncate
public static String truncate(String name, int length)
Truncates a name to the specified length while maintaining delimiters.- Parameters:
name
-length
-
-
convert
public static String convert(IdentifierConfiguration config, String rule, String name)
Convert a normalized name to a name using the specified configuration and naming rule. Note: Currently only delimiters are converted.- Parameters:
config
-rule
-name
-
-
combine
public static String combine(String name1, String name2)
Combines two names using default identifier rules.- Parameters:
name1
-name2
-
-
combine
public static String combine(String... names)
Combines multiple names using default identifier rules.- Parameters:
name1
-name2
-
-
append
public static String append(String name1, String name2)
Appends one string to another using default identifier rules.- Parameters:
name1
-name2
-
-
removeHungarianNotation
public static String removeHungarianNotation(String name)
Removes Hungarian notation from a string.- Parameters:
name1
-name2
-
-
removeDelimiters
public static String removeDelimiters(String name)
Removes default delimiters from a string.
-
delimit
public static String delimit(String name, boolean force)
Delimits a string if necessary, optionally forcing it to be delimited.
-
canSplit
public static boolean canSplit(String name)
Determines whether a name can be split into multiple components.
-
-