Interface IdentifierUtil
-
- All Known Subinterfaces:
DBIdentifierUtil
- All Known Implementing Classes:
DBIdentifierUtilImpl
,IdentifierUtilImpl
public interface IdentifierUtil
Base IdentifierUtil interface. Defines many operations for operating on strings using identifier rules.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BAR
static java.lang.String
CASE_LOWER
static java.lang.String
CASE_PRESERVE
static java.lang.String
CASE_UPPER
static char
DOLLAR_CHAR
static java.lang.String
DOT
static java.lang.String
DOUBLE_QUOTE
static java.lang.String
EMPTY
static java.lang.String
PERCENT
static java.lang.String
SPACE
static java.lang.String
UNDERSCORE
static char
UNDERSCORE_CHAR
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
appendNames(java.lang.String rule, java.lang.String name1, java.lang.String name2)
Append the names together while maintaining delimiters.java.lang.String
appendNames(IdentifierRule rule, java.lang.String name1, java.lang.String name2)
Append the names together while maintaining delimiters.boolean
canSplit(java.lang.String rule, java.lang.String name)
Determines whether a name can be split into multiple components.boolean
canSplit(java.lang.String rule, java.lang.String name, java.lang.String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.boolean
canSplit(IdentifierRule rule, java.lang.String name)
Determines whether a name can be split into multiple components.boolean
canSplit(IdentifierRule rule, java.lang.String name, java.lang.String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.java.lang.String
combineNames(java.lang.String rule, java.lang.String[] names)
Combines names using the specified delimiting rule and appropriate separatorsjava.lang.String
combineNames(java.lang.String rule, java.lang.String[] rules, java.lang.String[] names)
Combines names using delimiting rules and appropriate separatorsjava.lang.String
combineNames(java.lang.String rule, java.lang.String name1, java.lang.String name2)
Combines two names using delimiting rules and appropriate separatorsjava.lang.String
combineNames(IdentifierRule rule, java.lang.String[] names)
Combines names using the specified delimiting rule and appropriate separatorsjava.lang.String
combineNames(IdentifierRule rule, java.lang.String name1, java.lang.String name2)
Combines two names using delimiting rules and appropriate separatorsjava.lang.String
combineNames(IdentifierRule rule, IdentifierRule[] rules, java.lang.String[] names)
Combines names using delimiting rules and appropriate separatorsjava.lang.String
convert(IdentifierConfiguration config, java.lang.String rule, java.lang.String name)
Convert the string using this naming configuration to the supplied naming configuration.java.lang.String
convertFull(IdentifierConfiguration config, java.lang.String rule, java.lang.String fullName)
Converts a qualified string-based name defined using the base configuration to the specified configuration.java.lang.String
delimit(java.lang.String rule, java.lang.String name)
Delimit the name if it requires delimitersjava.lang.String
delimit(java.lang.String rule, java.lang.String name, boolean force)
Delimit the string with the option to force delimiting.java.lang.String
delimit(IdentifierRule rule, java.lang.String name)
Delimit the name if it requires delimitersjava.lang.String
delimit(IdentifierRule rule, java.lang.String name, boolean force)
Delimit the string with the option to force delimiting.IdentifierConfiguration
getIdentifierConfiguration()
Get the naming configuration.boolean
isDelimited(java.lang.String rule, java.lang.String name)
Determines whether a name is delimited.boolean
isDelimited(IdentifierRule rule, java.lang.String name)
Determines whether a name is delimited.boolean
isReservedWord(java.lang.String rule, java.lang.String name)
Returns whether a name is considered a reserved wordboolean
isReservedWord(IdentifierRule rule, java.lang.String name)
Returns whether a name is considered a reserved wordjava.lang.String
joinNames(java.lang.String[] rules, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsjava.lang.String
joinNames(java.lang.String rule, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsjava.lang.String
joinNames(java.lang.String rule, java.lang.String[] names, java.lang.String delimiter)
Joins several names with different naming rules into a single string using the specified delimiterjava.lang.String
joinNames(IdentifierRule[] rules, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsjava.lang.String
joinNames(IdentifierRule rule, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsjava.lang.String
joinNames(IdentifierRule rule, java.lang.String[] names, java.lang.String delimiter)
Joins several names with different naming rules into a single string using the specified delimiterjava.lang.String
removeDelimiters(java.lang.String rule, java.lang.String name)
Remove delimiters from a delimited namejava.lang.String
removeDelimiters(IdentifierConfiguration config, java.lang.String rule, java.lang.String name)
Remove delimiters from a delimited namejava.lang.String
removeDelimiters(IdentifierRule rule, java.lang.String name)
Remove delimiters from a delimited namejava.lang.String
removeHungarianNotation(java.lang.String rule, java.lang.String name)
Removes Hungarian notation from the specified string.java.lang.String
removeHungarianNotation(IdentifierRule rule, java.lang.String name)
Removes Hungarian notation from the specified string.boolean
requiresDelimiters(java.lang.String rule, java.lang.String name)
Determines whether a name requires delimiters based upon: The SQL-92 Reference definition of a valid unquoted name The naming rule specifiedboolean
requiresDelimiters(IdentifierRule rule, java.lang.String name)
Determines whether a name requires delimiters based upon: The SQL-92 Reference definition of a valid unquoted name The naming rule specifiedvoid
setIdentifierConfiguration(IdentifierConfiguration config)
Set the naming configuration to use for naming operations.java.lang.String[]
splitName(java.lang.String rule, java.lang.String name)
Splits a combined name name using the provided naming rulejava.lang.String[]
splitName(java.lang.String rule, java.lang.String name, java.lang.String delimiter)
Splits a combined name name using the provided naming rule and delimiter.java.lang.String[]
splitName(IdentifierRule rule, java.lang.String name)
Splits a combined name name using the provided naming rulejava.lang.String[]
splitName(IdentifierRule rule, java.lang.String name, java.lang.String delimiter)
Splits a combined name name using the provided naming rule and delimiter.java.lang.String
truncateName(java.lang.String rule, java.lang.String name, int length)
Truncates a name while maintaining delimiters.java.lang.String
truncateName(IdentifierRule rule, java.lang.String name, int length)
Truncates a name while maintaining delimiters.
-
-
-
Field Detail
-
DOUBLE_QUOTE
static final java.lang.String DOUBLE_QUOTE
- See Also:
- Constant Field Values
-
DOT
static final java.lang.String DOT
- See Also:
- Constant Field Values
-
UNDERSCORE
static final java.lang.String UNDERSCORE
- See Also:
- Constant Field Values
-
SPACE
static final java.lang.String SPACE
- See Also:
- Constant Field Values
-
BAR
static final java.lang.String BAR
- See Also:
- Constant Field Values
-
EMPTY
static final java.lang.String EMPTY
- See Also:
- Constant Field Values
-
PERCENT
static final java.lang.String PERCENT
- See Also:
- Constant Field Values
-
DOLLAR_CHAR
static final char DOLLAR_CHAR
- See Also:
- Constant Field Values
-
UNDERSCORE_CHAR
static final char UNDERSCORE_CHAR
- See Also:
- Constant Field Values
-
CASE_UPPER
static final java.lang.String CASE_UPPER
- See Also:
- Constant Field Values
-
CASE_LOWER
static final java.lang.String CASE_LOWER
- See Also:
- Constant Field Values
-
CASE_PRESERVE
static final java.lang.String CASE_PRESERVE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getIdentifierConfiguration
IdentifierConfiguration getIdentifierConfiguration()
Get the naming configuration.
-
setIdentifierConfiguration
void setIdentifierConfiguration(IdentifierConfiguration config)
Set the naming configuration to use for naming operations. A naming configuration must be set before calling any other methods.
-
delimit
java.lang.String delimit(java.lang.String rule, java.lang.String name)
Delimit the name if it requires delimiters- Parameters:
rule
- the rule to use for delimitingname
- the name to delimit- Returns:
- the delimited name, if delimiting was necessary.
-
delimit
java.lang.String delimit(IdentifierRule rule, java.lang.String name)
Delimit the name if it requires delimiters- Parameters:
rule
- the rule to use for delimitingname
- the name to delimit- Returns:
- the delimited name, if delimiting was necessary.
-
delimit
java.lang.String delimit(java.lang.String rule, java.lang.String name, boolean force)
Delimit the string with the option to force delimiting. If force is true, the name will delimited without checking to see if it requires delimiters.- Parameters:
rule
- the rule to use for delimitingname
- the name to delimitforce
- add delimiters even if delimiting is not required- Returns:
- the delimited name, if delimiting was necessary.
-
delimit
java.lang.String delimit(IdentifierRule rule, java.lang.String name, boolean force)
Delimit the string with the option to force delimiting. If force is true, the name will delimited without checking to see if it requires delimiters.- Parameters:
rule
- the rule to use for delimitingname
- the name to delimitforce
- add delimiters even if delimiting is not required- Returns:
- the delimited name, if delimiting was necessary.
-
removeDelimiters
java.lang.String removeDelimiters(java.lang.String rule, java.lang.String name)
Remove delimiters from a delimited name- Parameters:
rule
- the rule to use for removing delimitersname
- the name from which to remove delimiters
-
removeDelimiters
java.lang.String removeDelimiters(IdentifierConfiguration config, java.lang.String rule, java.lang.String name)
Remove delimiters from a delimited name- Parameters:
rule
- the rule to use for removing delimitersname
- the name from which to remove delimiters
-
removeDelimiters
java.lang.String removeDelimiters(IdentifierRule rule, java.lang.String name)
Remove delimiters from a delimited name- Parameters:
rule
- the rule to use for removing delimitersname
- the name from which to remove delimiters
-
isDelimited
boolean isDelimited(java.lang.String rule, java.lang.String name)
Determines whether a name is delimited.- Parameters:
rule
- the rule to use for removing delimitersname
- the name to examine for delimiters
-
isDelimited
boolean isDelimited(IdentifierRule rule, java.lang.String name)
Determines whether a name is delimited.- Parameters:
rule
- the rule to use for removing delimitersname
- the name to examine for delimiters
-
requiresDelimiters
boolean requiresDelimiters(java.lang.String rule, java.lang.String name)
Determines whether a name requires delimiters based upon:- The SQL-92 Reference definition of a valid unquoted name
- The naming rule specified
- Parameters:
rule
- the rule to use for removing delimitersname
- the name to examine for delimiting requirements
-
requiresDelimiters
boolean requiresDelimiters(IdentifierRule rule, java.lang.String name)
Determines whether a name requires delimiters based upon:- The SQL-92 Reference definition of a valid unquoted name
- The naming rule specified
- Parameters:
rule
- the rule to use for removing delimitersname
- the name to examine for delimiting requirements
-
combineNames
java.lang.String combineNames(java.lang.String rule, java.lang.String[] rules, java.lang.String[] names)
Combines names using delimiting rules and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
java.lang.String combineNames(IdentifierRule rule, IdentifierRule[] rules, java.lang.String[] names)
Combines names using delimiting rules and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
java.lang.String combineNames(java.lang.String rule, java.lang.String[] names)
Combines names using the specified delimiting rule and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
java.lang.String combineNames(IdentifierRule rule, java.lang.String[] names)
Combines names using the specified delimiting rule and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
java.lang.String combineNames(java.lang.String rule, java.lang.String name1, java.lang.String name2)
Combines two names using delimiting rules and appropriate separators
-
combineNames
java.lang.String combineNames(IdentifierRule rule, java.lang.String name1, java.lang.String name2)
Combines two names using delimiting rules and appropriate separators
-
joinNames
java.lang.String joinNames(java.lang.String[] rules, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
java.lang.String joinNames(IdentifierRule[] rules, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
java.lang.String joinNames(java.lang.String rule, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
java.lang.String joinNames(IdentifierRule rule, java.lang.String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
java.lang.String joinNames(IdentifierRule rule, java.lang.String[] names, java.lang.String delimiter)
Joins several names with different naming rules into a single string using the specified delimiter
-
joinNames
java.lang.String joinNames(java.lang.String rule, java.lang.String[] names, java.lang.String delimiter)
Joins several names with different naming rules into a single string using the specified delimiter
-
splitName
java.lang.String[] splitName(java.lang.String rule, java.lang.String name)
Splits a combined name name using the provided naming rule- Parameters:
name
- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
splitName
java.lang.String[] splitName(IdentifierRule rule, java.lang.String name)
Splits a combined name name using the provided naming rule- Parameters:
name
- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
splitName
java.lang.String[] splitName(java.lang.String rule, java.lang.String name, java.lang.String delimiter)
Splits a combined name name using the provided naming rule and delimiter.- Parameters:
name
- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
splitName
java.lang.String[] splitName(IdentifierRule rule, java.lang.String name, java.lang.String delimiter)
Splits a combined name name using the provided naming rule and delimiter.- Parameters:
name
- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
isReservedWord
boolean isReservedWord(java.lang.String rule, java.lang.String name)
Returns whether a name is considered a reserved word
-
isReservedWord
boolean isReservedWord(IdentifierRule rule, java.lang.String name)
Returns whether a name is considered a reserved word
-
convert
java.lang.String convert(IdentifierConfiguration config, java.lang.String rule, java.lang.String name)
Convert the string using this naming configuration to the supplied naming configuration.
-
truncateName
java.lang.String truncateName(java.lang.String rule, java.lang.String name, int length)
Truncates a name while maintaining delimiters.
-
truncateName
java.lang.String truncateName(IdentifierRule rule, java.lang.String name, int length)
Truncates a name while maintaining delimiters.
-
appendNames
java.lang.String appendNames(IdentifierRule rule, java.lang.String name1, java.lang.String name2)
Append the names together while maintaining delimiters.
-
appendNames
java.lang.String appendNames(java.lang.String rule, java.lang.String name1, java.lang.String name2)
Append the names together while maintaining delimiters.
-
convertFull
java.lang.String convertFull(IdentifierConfiguration config, java.lang.String rule, java.lang.String fullName)
Converts a qualified string-based name defined using the base configuration to the specified configuration. Returns the converted name.
-
removeHungarianNotation
java.lang.String removeHungarianNotation(java.lang.String rule, java.lang.String name)
Removes Hungarian notation from the specified string.
-
removeHungarianNotation
java.lang.String removeHungarianNotation(IdentifierRule rule, java.lang.String name)
Removes Hungarian notation from the specified string.
-
canSplit
boolean canSplit(java.lang.String rule, java.lang.String name)
Determines whether a name can be split into multiple components.
-
canSplit
boolean canSplit(IdentifierRule rule, java.lang.String name)
Determines whether a name can be split into multiple components.
-
canSplit
boolean canSplit(java.lang.String rule, java.lang.String name, java.lang.String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.
-
canSplit
boolean canSplit(IdentifierRule rule, java.lang.String name, java.lang.String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.
-
-