Class IdentifierUtilImpl
- java.lang.Object
-
- org.apache.openjpa.lib.identifier.IdentifierUtilImpl
-
- All Implemented Interfaces:
Configurable,IdentifierUtil
public class IdentifierUtilImpl extends Object implements IdentifierUtil, Configurable
Implementation class for the base identifier impl.
-
-
Field Summary
-
Fields inherited from interface org.apache.openjpa.lib.identifier.IdentifierUtil
BAR, CASE_LOWER, CASE_PRESERVE, CASE_UPPER, DOLLAR_CHAR, DOT, DOUBLE_QUOTE, EMPTY, PERCENT, SPACE, UNDERSCORE, UNDERSCORE_CHAR
-
-
Constructor Summary
Constructors Constructor Description IdentifierUtilImpl()IdentifierUtilImpl(IdentifierConfiguration config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringappendNames(String rule, String name1, String name2)Append the names together while maintaining delimiters.StringappendNames(IdentifierRule rule, String name1, String name2)Append the names together while maintaining delimiters.booleancanSplit(String rule, String name)Determines whether a name can be split into multiple components.booleancanSplit(String rule, String name, String delim)Determines whether a name can be split into multiple components, taking into account the specified delimiter.booleancanSplit(IdentifierRule rule, String name)Determines whether a name can be split into multiple components.booleancanSplit(IdentifierRule rule, String name, String delim)Determines whether a name can be split into multiple components, taking into account the specified delimiter.StringcombineFull(IdentifierConfiguration config, String rule, String fullName)StringcombineNames(String rule, String[] names)Combines names using the specified delimiting rule and appropriate separatorsStringcombineNames(String rule, String[] rules, String[] names)Combines names using delimiting rules and appropriate separatorsStringcombineNames(String rule, String name1, String name2)Combines two names using delimiting rules and appropriate separatorsStringcombineNames(IdentifierConfiguration config, String rule, String[] names)StringcombineNames(IdentifierConfiguration config, IdentifierRule namingRule, String[] names)StringcombineNames(IdentifierConfiguration config, IdentifierRule rule, String name1, String name2)StringcombineNames(IdentifierConfiguration config, IdentifierRule rule, IdentifierRule[] rules, String[] names)StringcombineNames(IdentifierRule rule, String[] names)Combines names using the specified delimiting rule and appropriate separatorsStringcombineNames(IdentifierRule rule, String name1, String name2)Combines two names using delimiting rules and appropriate separatorsStringcombineNames(IdentifierRule rule, IdentifierRule[] rules, String[] names)Combines names using delimiting rules and appropriate separatorsStringconvert(IdentifierConfiguration config, String rule, String name)Convert the string using this naming configuration to the supplied naming configuration.StringconvertFull(IdentifierConfiguration config, String rule, String fullName)Converts a qualified string-based name defined using the base configuration to the specified configuration.Stringdelimit(String rule, String name)Delimit the name if it requires delimitersStringdelimit(String rule, String name, boolean force)Delimit the string with the option to force delimiting.Stringdelimit(IdentifierConfiguration config, IdentifierRule rule, String name)Stringdelimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force)Stringdelimit(IdentifierRule rule, String name)Delimit the name if it requires delimitersStringdelimit(IdentifierRule rule, String name, boolean force)Delimit the string with the option to force delimiting.voidendConfiguration()Invoked upon completion of bean property configuration for this object.IdentifierConfigurationgetIdentifierConfiguration()Get the naming configuration.booleanisDelimited(String rule, String name)Determines whether a name is delimited.booleanisDelimited(IdentifierConfiguration config, IdentifierRule rule, String name)booleanisDelimited(IdentifierRule rule, String name)Determines whether a name is delimited.static booleanisDoubleQuoted(String name)Returns whether a name is double quotedbooleanisReservedWord(String rule, String name)Returns whether a name is considered a reserved wordbooleanisReservedWord(IdentifierRule rule, String name)Returns whether a name is considered a reserved word.StringjoinNames(String[] rules, String[] names)Joins several names with different naming rules into a single string using appropriate delimiters and separatorsStringjoinNames(String rule, String[] names)Joins several names with different naming rules into a single string using appropriate delimiters and separatorsStringjoinNames(String rule, String[] names, String delimiter)Joins several names with different naming rules into a single string using the specified delimiterStringjoinNames(IdentifierConfiguration config, IdentifierRule rule, String[] names, String delimiter)Join names using a single naming rule and specified delimiterStringjoinNames(IdentifierRule[] rules, String[] names)Joins multiple names together using the standard delimiting rules ex. ( {"s", "t", "c"} --> "s"."StringjoinNames(IdentifierRule rule, String[] names)Joins several names with different naming rules into a single string using appropriate delimiters and separatorsStringjoinNames(IdentifierRule rule, String[] names, String delimiter)Joins several names with different naming rules into a single string using the specified delimiterprotected booleanneedsConversion(IdentifierConfiguration config)StringremoveDelimiters(String rule, String name)Remove delimiters from a delimited nameStringremoveDelimiters(IdentifierConfiguration config, String rule, String name)Remove delimiters from a delimited nameStringremoveDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)protected StringremoveDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name, String leading, String trailing)StringremoveDelimiters(IdentifierRule rule, String name)Remove delimiters from a delimited nameStringremoveHungarianNotation(String rule, String name)Removes Hungarian notation from the specified string.StringremoveHungarianNotation(IdentifierRule rule, String name)Removes Hungarian notation from the specified string.booleanrequiresDelimiters(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 specifiedbooleanrequiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)booleanrequiresDelimiters(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 specifiedvoidsetConfiguration(Configuration conf)Invoked prior to setting bean properties.voidsetIdentifierConfiguration(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 nrule, String name, String nameDelim)Splits a combined name name using the provided naming rule and delimiter.String[]splitName(IdentifierConfiguration config, String rule, String name)String[]splitName(IdentifierConfiguration config, IdentifierRule nrule, String name)String[]splitName(IdentifierRule nrule, String name)Splits a combined name name using the provided naming ruleString[]splitName(IdentifierRule nrule, String name, String nameDelim)Splits names using single naming rule and appropriate separatorsvoidstartConfiguration()Invoked before bean property configuration is begun on this object.StringtruncateName(String rule, String name, int length)Truncates a name while maintaining delimiters.StringtruncateName(IdentifierRule namingRule, String name, int length)Truncates a name while maintaining delimiters.
-
-
-
Constructor Detail
-
IdentifierUtilImpl
public IdentifierUtilImpl()
-
IdentifierUtilImpl
public IdentifierUtilImpl(IdentifierConfiguration config)
-
-
Method Detail
-
setIdentifierConfiguration
public void setIdentifierConfiguration(IdentifierConfiguration config)
Description copied from interface:IdentifierUtilSet the naming configuration to use for naming operations. A naming configuration must be set before calling any other methods.- Specified by:
setIdentifierConfigurationin interfaceIdentifierUtil
-
getIdentifierConfiguration
public IdentifierConfiguration getIdentifierConfiguration()
Description copied from interface:IdentifierUtilGet the naming configuration.- Specified by:
getIdentifierConfigurationin interfaceIdentifierUtil
-
combineNames
public String combineNames(String rule, String name1, String name2)
Description copied from interface:IdentifierUtilCombines two names using delimiting rules and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil
-
combineNames
public String combineNames(String rule, String[] names)
Description copied from interface:IdentifierUtilCombines names using the specified delimiting rule and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
public String combineNames(IdentifierConfiguration config, String rule, String[] names)
-
combineNames
public String combineNames(IdentifierRule rule, IdentifierRule[] rules, String[] names)
Description copied from interface:IdentifierUtilCombines names using delimiting rules and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
public String combineNames(IdentifierConfiguration config, IdentifierRule rule, IdentifierRule[] rules, String[] names)
-
combineNames
public String combineNames(IdentifierConfiguration config, IdentifierRule rule, String name1, String name2)
-
combineNames
public String combineNames(IdentifierConfiguration config, IdentifierRule namingRule, String[] names)
-
appendNames
public String appendNames(IdentifierRule rule, String name1, String name2)
Description copied from interface:IdentifierUtilAppend the names together while maintaining delimiters.- Specified by:
appendNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(IdentifierRule[] rules, String[] names)
Joins multiple names together using the standard delimiting rules ex. ( {"s", "t", "c"} --> "s"."t"."c" }- Specified by:
joinNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(String rule, String[] names)
Description copied from interface:IdentifierUtilJoins several names with different naming rules into a single string using appropriate delimiters and separators- Specified by:
joinNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(IdentifierRule rule, String[] names)
Description copied from interface:IdentifierUtilJoins several names with different naming rules into a single string using appropriate delimiters and separators- Specified by:
joinNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(IdentifierRule rule, String[] names, String delimiter)
Description copied from interface:IdentifierUtilJoins several names with different naming rules into a single string using the specified delimiter- Specified by:
joinNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(String rule, String[] names, String delimiter)
Description copied from interface:IdentifierUtilJoins several names with different naming rules into a single string using the specified delimiter- Specified by:
joinNamesin interfaceIdentifierUtil
-
joinNames
public String joinNames(IdentifierConfiguration config, IdentifierRule rule, String[] names, String delimiter)
Join names using a single naming rule and specified delimiter- Parameters:
rule-names-
-
splitName
public String[] splitName(IdentifierConfiguration config, IdentifierRule nrule, String name)
-
splitName
public String[] splitName(IdentifierRule nrule, String name)
Description copied from interface:IdentifierUtilSplits a combined name name using the provided naming rule- Specified by:
splitNamein interfaceIdentifierUtilname- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
splitName
public String[] splitName(IdentifierRule nrule, String name, String nameDelim)
Splits names using single naming rule and appropriate separators- Specified by:
splitNamein interfaceIdentifierUtil- Parameters:
name- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
isDoubleQuoted
public static boolean isDoubleQuoted(String name)
Returns whether a name is double quoted
-
delimit
public String delimit(IdentifierConfiguration config, IdentifierRule rule, String name)
-
delimit
public String delimit(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilDelimit the name if it requires delimiters- Specified by:
delimitin interfaceIdentifierUtil- Parameters:
rule- the rule to use for delimitingname- the name to delimit- Returns:
- the delimited name, if delimiting was necessary.
-
delimit
public String delimit(IdentifierRule rule, String name, boolean force)
Description copied from interface:IdentifierUtilDelimit the string with the option to force delimiting. If force is true, the name will delimited without checking to see if it requires delimiters.- Specified by:
delimitin interfaceIdentifierUtil- 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
public String delimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force)
-
isDelimited
public boolean isDelimited(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name is delimited.- Specified by:
isDelimitedin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name to examine for delimiters
-
isDelimited
public boolean isDelimited(IdentifierConfiguration config, IdentifierRule rule, String name)
-
removeDelimiters
public String removeDelimiters(IdentifierConfiguration config, String rule, String name)
Description copied from interface:IdentifierUtilRemove delimiters from a delimited name- Specified by:
removeDelimitersin interfaceIdentifierUtilrule- the rule to use for removing delimitersname- the name from which to remove delimiters
-
removeDelimiters
public String removeDelimiters(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilRemove delimiters from a delimited name- Specified by:
removeDelimitersin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name from which to remove delimiters
-
removeDelimiters
public String removeDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)
-
requiresDelimiters
public boolean requiresDelimiters(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name requires delimiters based upon:- The SQL-92 Reference definition of a valid unquoted name
- The naming rule specified
- Specified by:
requiresDelimitersin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name to examine for delimiting requirements
-
requiresDelimiters
public boolean requiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)
-
isReservedWord
public boolean isReservedWord(IdentifierRule rule, String name)
Returns whether a name is considered a reserved word.- Specified by:
isReservedWordin interfaceIdentifierUtil
-
isReservedWord
public boolean isReservedWord(String rule, String name)
Description copied from interface:IdentifierUtilReturns whether a name is considered a reserved word- Specified by:
isReservedWordin interfaceIdentifierUtil
-
removeDelimiters
protected String removeDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name, String leading, String trailing)
-
combineNames
public String combineNames(String rule, String[] rules, String[] names)
Description copied from interface:IdentifierUtilCombines names using delimiting rules and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
truncateName
public String truncateName(String rule, String name, int length)
Description copied from interface:IdentifierUtilTruncates a name while maintaining delimiters.- Specified by:
truncateNamein interfaceIdentifierUtil
-
truncateName
public String truncateName(IdentifierRule namingRule, String name, int length)
Description copied from interface:IdentifierUtilTruncates a name while maintaining delimiters.- Specified by:
truncateNamein interfaceIdentifierUtil
-
delimit
public String delimit(String rule, String name)
Description copied from interface:IdentifierUtilDelimit the name if it requires delimiters- Specified by:
delimitin interfaceIdentifierUtil- Parameters:
rule- the rule to use for delimitingname- the name to delimit- Returns:
- the delimited name, if delimiting was necessary.
-
delimit
public String delimit(String rule, String name, boolean force)
Description copied from interface:IdentifierUtilDelimit the string with the option to force delimiting. If force is true, the name will delimited without checking to see if it requires delimiters.- Specified by:
delimitin interfaceIdentifierUtil- 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.
-
isDelimited
public boolean isDelimited(String rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name is delimited.- Specified by:
isDelimitedin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name to examine for delimiters
-
removeDelimiters
public String removeDelimiters(String rule, String name)
Description copied from interface:IdentifierUtilRemove delimiters from a delimited name- Specified by:
removeDelimitersin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name from which to remove delimiters
-
requiresDelimiters
public boolean requiresDelimiters(String rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name requires delimiters based upon:- The SQL-92 Reference definition of a valid unquoted name
- The naming rule specified
- Specified by:
requiresDelimitersin interfaceIdentifierUtil- Parameters:
rule- the rule to use for removing delimitersname- the name to examine for delimiting requirements
-
splitName
public String[] splitName(IdentifierConfiguration config, String rule, String name)
-
splitName
public String[] splitName(String rule, String name)
Description copied from interface:IdentifierUtilSplits a combined name name using the provided naming rule- Specified by:
splitNamein interfaceIdentifierUtilname- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
joinNames
public String joinNames(String[] rules, String[] names)
Description copied from interface:IdentifierUtilJoins several names with different naming rules into a single string using appropriate delimiters and separators- Specified by:
joinNamesin interfaceIdentifierUtil
-
appendNames
public String appendNames(String rule, String name1, String name2)
Description copied from interface:IdentifierUtilAppend the names together while maintaining delimiters.- Specified by:
appendNamesin interfaceIdentifierUtil
-
removeHungarianNotation
public String removeHungarianNotation(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilRemoves Hungarian notation from the specified string.- Specified by:
removeHungarianNotationin interfaceIdentifierUtil
-
removeHungarianNotation
public String removeHungarianNotation(String rule, String name)
Description copied from interface:IdentifierUtilRemoves Hungarian notation from the specified string.- Specified by:
removeHungarianNotationin interfaceIdentifierUtil
-
splitName
public String[] splitName(String nrule, String name, String nameDelim)
Description copied from interface:IdentifierUtilSplits a combined name name using the provided naming rule and delimiter.- Specified by:
splitNamein interfaceIdentifierUtilname- the multi-value name- Returns:
- individual components of the name ex. schema.table --> { schema, table }
-
convert
public String convert(IdentifierConfiguration config, String rule, String name)
Description copied from interface:IdentifierUtilConvert the string using this naming configuration to the supplied naming configuration.- Specified by:
convertin interfaceIdentifierUtil
-
convertFull
public String convertFull(IdentifierConfiguration config, String rule, String fullName)
Description copied from interface:IdentifierUtilConverts a qualified string-based name defined using the base configuration to the specified configuration. Returns the converted name.- Specified by:
convertFullin interfaceIdentifierUtil
-
combineFull
public String combineFull(IdentifierConfiguration config, String rule, String fullName)
-
needsConversion
protected boolean needsConversion(IdentifierConfiguration config)
-
endConfiguration
public void endConfiguration()
Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:ConfigurableInvoked prior to setting bean properties.- Specified by:
setConfigurationin interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:ConfigurableInvoked before bean property configuration is begun on this object.- Specified by:
startConfigurationin interfaceConfigurable
-
canSplit
public boolean canSplit(String rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name can be split into multiple components.- Specified by:
canSplitin interfaceIdentifierUtil
-
canSplit
public boolean canSplit(IdentifierRule rule, String name)
Description copied from interface:IdentifierUtilDetermines whether a name can be split into multiple components.- Specified by:
canSplitin interfaceIdentifierUtil
-
canSplit
public boolean canSplit(String rule, String name, String delim)
Description copied from interface:IdentifierUtilDetermines whether a name can be split into multiple components, taking into account the specified delimiter.- Specified by:
canSplitin interfaceIdentifierUtil
-
canSplit
public boolean canSplit(IdentifierRule rule, String name, String delim)
Description copied from interface:IdentifierUtilDetermines whether a name can be split into multiple components, taking into account the specified delimiter.- Specified by:
canSplitin interfaceIdentifierUtil
-
combineNames
public String combineNames(IdentifierRule rule, String[] names)
Description copied from interface:IdentifierUtilCombines names using the specified delimiting rule and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil- Returns:
- a combined name ex. {"TH IS", THAT} -> "TH IS_THAT"
-
combineNames
public String combineNames(IdentifierRule rule, String name1, String name2)
Description copied from interface:IdentifierUtilCombines two names using delimiting rules and appropriate separators- Specified by:
combineNamesin interfaceIdentifierUtil
-
-