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