Interface IdentifierUtil
-
- All Known Implementing Classes:
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 String
BAR
static String
CASE_LOWER
static String
CASE_PRESERVE
static String
CASE_UPPER
static char
DOLLAR_CHAR
static String
DOT
static String
DOUBLE_QUOTE
static String
EMPTY
static String
PERCENT
static String
SPACE
static String
UNDERSCORE
static char
UNDERSCORE_CHAR
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
appendNames(String rule, String name1, String name2)
Append the names together while maintaining delimiters.String
appendNames(IdentifierRule rule, String name1, String name2)
Append the names together while maintaining delimiters.boolean
canSplit(String rule, String name)
Determines whether a name can be split into multiple components.boolean
canSplit(String rule, String name, String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.boolean
canSplit(IdentifierRule rule, String name)
Determines whether a name can be split into multiple components.boolean
canSplit(IdentifierRule rule, String name, String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.String
combineNames(String rule, String[] names)
Combines names using the specified delimiting rule and appropriate separatorsString
combineNames(String rule, String[] rules, String[] names)
Combines names using delimiting rules and appropriate separatorsString
combineNames(String rule, String name1, String name2)
Combines two names using delimiting rules and appropriate separatorsString
combineNames(IdentifierRule rule, String[] names)
Combines names using the specified delimiting rule and appropriate separatorsString
combineNames(IdentifierRule rule, String name1, String name2)
Combines two names using delimiting rules and appropriate separatorsString
combineNames(IdentifierRule rule, IdentifierRule[] rules, String[] names)
Combines names using delimiting rules and appropriate separatorsString
convert(IdentifierConfiguration config, String rule, String name)
Convert the string using this naming configuration to the supplied naming configuration.String
convertFull(IdentifierConfiguration config, String rule, String fullName)
Converts a qualified string-based name defined using the base configuration to the specified configuration.String
delimit(String rule, String name)
Delimit the name if it requires delimitersString
delimit(String rule, String name, boolean force)
Delimit the string with the option to force delimiting.String
delimit(IdentifierRule rule, String name)
Delimit the name if it requires delimitersString
delimit(IdentifierRule rule, String name, boolean force)
Delimit the string with the option to force delimiting.IdentifierConfiguration
getIdentifierConfiguration()
Get the naming configuration.boolean
isDelimited(String rule, String name)
Determines whether a name is delimited.boolean
isDelimited(IdentifierRule rule, String name)
Determines whether a name is delimited.boolean
isReservedWord(String rule, String name)
Returns whether a name is considered a reserved wordboolean
isReservedWord(IdentifierRule rule, String name)
Returns whether a name is considered a reserved wordString
joinNames(String[] rules, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsString
joinNames(String rule, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsString
joinNames(String rule, String[] names, String delimiter)
Joins several names with different naming rules into a single string using the specified delimiterString
joinNames(IdentifierRule[] rules, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsString
joinNames(IdentifierRule rule, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separatorsString
joinNames(IdentifierRule rule, String[] names, String delimiter)
Joins several names with different naming rules into a single string using the specified delimiterString
removeDelimiters(String rule, String name)
Remove delimiters from a delimited nameString
removeDelimiters(IdentifierConfiguration config, String rule, String name)
Remove delimiters from a delimited nameString
removeDelimiters(IdentifierRule rule, String name)
Remove delimiters from a delimited nameString
removeHungarianNotation(String rule, String name)
Removes Hungarian notation from the specified string.String
removeHungarianNotation(IdentifierRule rule, String name)
Removes Hungarian notation from the specified string.boolean
requiresDelimiters(String rule, 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, 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.String[]
splitName(String rule, String name)
Splits a combined name name using the provided naming ruleString[]
splitName(String rule, String name, String delimiter)
Splits a combined name name using the provided naming rule and delimiter.String[]
splitName(IdentifierRule rule, String name)
Splits a combined name name using the provided naming ruleString[]
splitName(IdentifierRule rule, String name, String delimiter)
Splits a combined name name using the provided naming rule and delimiter.String
truncateName(String rule, String name, int length)
Truncates a name while maintaining delimiters.String
truncateName(IdentifierRule rule, String name, int length)
Truncates a name while maintaining delimiters.
-
-
-
Field Detail
-
DOUBLE_QUOTE
static final String DOUBLE_QUOTE
- See Also:
- Constant Field Values
-
DOT
static final String DOT
- See Also:
- Constant Field Values
-
UNDERSCORE
static final String UNDERSCORE
- See Also:
- Constant Field Values
-
SPACE
static final String SPACE
- See Also:
- Constant Field Values
-
BAR
static final String BAR
- See Also:
- Constant Field Values
-
EMPTY
static final String EMPTY
- See Also:
- Constant Field Values
-
PERCENT
static final 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 String CASE_UPPER
- See Also:
- Constant Field Values
-
CASE_LOWER
static final String CASE_LOWER
- See Also:
- Constant Field Values
-
CASE_PRESERVE
static final 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
String delimit(String rule, 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
String delimit(IdentifierRule rule, 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
String delimit(String rule, 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
String delimit(IdentifierRule rule, 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
String removeDelimiters(String rule, 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
String removeDelimiters(IdentifierConfiguration config, String rule, 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
String removeDelimiters(IdentifierRule rule, 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(String rule, 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, 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(String rule, 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, 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
String combineNames(String rule, String[] rules, String[] names)
Combines names using delimiting rules and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
String combineNames(IdentifierRule rule, IdentifierRule[] rules, String[] names)
Combines names using delimiting rules and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
String combineNames(String rule, String[] names)
Combines names using the specified delimiting rule and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
String combineNames(IdentifierRule rule, String[] names)
Combines names using the specified delimiting rule and appropriate separators- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
String combineNames(String rule, String name1, String name2)
Combines two names using delimiting rules and appropriate separators
-
combineNames
String combineNames(IdentifierRule rule, String name1, String name2)
Combines two names using delimiting rules and appropriate separators
-
joinNames
String joinNames(String[] rules, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
String joinNames(IdentifierRule[] rules, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
String joinNames(String rule, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
String joinNames(IdentifierRule rule, String[] names)
Joins several names with different naming rules into a single string using appropriate delimiters and separators
-
joinNames
String joinNames(IdentifierRule rule, String[] names, String delimiter)
Joins several names with different naming rules into a single string using the specified delimiter
-
joinNames
String joinNames(String rule, String[] names, String delimiter)
Joins several names with different naming rules into a single string using the specified delimiter
-
splitName
String[] splitName(String rule, 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
String[] splitName(IdentifierRule rule, 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
String[] splitName(String rule, String name, 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
String[] splitName(IdentifierRule rule, String name, 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(String rule, String name)
Returns whether a name is considered a reserved word
-
isReservedWord
boolean isReservedWord(IdentifierRule rule, String name)
Returns whether a name is considered a reserved word
-
convert
String convert(IdentifierConfiguration config, String rule, String name)
Convert the string using this naming configuration to the supplied naming configuration.
-
truncateName
String truncateName(String rule, String name, int length)
Truncates a name while maintaining delimiters.
-
truncateName
String truncateName(IdentifierRule rule, String name, int length)
Truncates a name while maintaining delimiters.
-
appendNames
String appendNames(IdentifierRule rule, String name1, String name2)
Append the names together while maintaining delimiters.
-
appendNames
String appendNames(String rule, String name1, String name2)
Append the names together while maintaining delimiters.
-
convertFull
String convertFull(IdentifierConfiguration config, String rule, String fullName)
Converts a qualified string-based name defined using the base configuration to the specified configuration. Returns the converted name.
-
removeHungarianNotation
String removeHungarianNotation(String rule, String name)
Removes Hungarian notation from the specified string.
-
removeHungarianNotation
String removeHungarianNotation(IdentifierRule rule, String name)
Removes Hungarian notation from the specified string.
-
canSplit
boolean canSplit(String rule, String name)
Determines whether a name can be split into multiple components.
-
canSplit
boolean canSplit(IdentifierRule rule, String name)
Determines whether a name can be split into multiple components.
-
canSplit
boolean canSplit(String rule, String name, String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.
-
canSplit
boolean canSplit(IdentifierRule rule, String name, String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.
-
-