org.apache.openjpa.lib.identifier
Class IdentifierUtilImpl

java.lang.Object
  extended by org.apache.openjpa.lib.identifier.IdentifierUtilImpl
All Implemented Interfaces:
Configurable, IdentifierUtil
Direct Known Subclasses:
DBIdentifierUtilImpl

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
IdentifierUtilImpl()
           
IdentifierUtilImpl(IdentifierConfiguration config)
           
 
Method Summary
 String appendNames(IdentifierRule rule, String name1, String name2)
          Append the names together while maintaining delimiters.
 String appendNames(String rule, String name1, String name2)
          Append the names together while maintaining delimiters.
 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.
 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.
 String combineFull(IdentifierConfiguration config, String rule, String fullName)
           
 String combineNames(IdentifierConfiguration config, IdentifierRule rule, IdentifierRule[] rules, String[] names)
           
 String combineNames(IdentifierConfiguration config, IdentifierRule namingRule, String[] names)
           
 String combineNames(IdentifierConfiguration config, IdentifierRule rule, String name1, String name2)
           
 String combineNames(IdentifierConfiguration config, String rule, String[] names)
           
 String combineNames(IdentifierRule rule, IdentifierRule[] rules, String[] names)
          Combines names using delimiting rules and appropriate separators
 String combineNames(IdentifierRule rule, String[] names)
          Combines names using the specified delimiting rule and appropriate separators
 String combineNames(IdentifierRule rule, String name1, String name2)
          Combines two names using delimiting rules and appropriate separators
 String combineNames(String rule, String[] names)
          Combines names using the specified delimiting rule and appropriate separators
 String combineNames(String rule, String[] rules, String[] names)
          Combines names using delimiting rules and appropriate separators
 String combineNames(String rule, String name1, String name2)
          Combines two names using delimiting rules and appropriate separators
 String 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(IdentifierConfiguration config, IdentifierRule rule, String name)
           
 String delimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force)
           
 String delimit(IdentifierRule rule, String name)
          Delimit the name if it requires delimiters
 String delimit(IdentifierRule rule, String name, boolean force)
          Delimit the string with the option to force delimiting.
 String delimit(String rule, String name)
          Delimit the name if it requires delimiters
 String delimit(String rule, String name, boolean force)
          Delimit the string with the option to force delimiting.
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 IdentifierConfiguration getIdentifierConfiguration()
          Get the naming configuration.
 boolean isDelimited(IdentifierConfiguration config, IdentifierRule rule, String name)
           
 boolean isDelimited(IdentifierRule rule, String name)
          Determines whether a name is delimited.
 boolean isDelimited(String rule, String name)
          Determines whether a name is delimited.
static boolean isDoubleQuoted(String name)
          Returns whether a name is double quoted
 boolean isReservedWord(IdentifierRule rule, String name)
          Returns whether a name is considered a reserved word.
 boolean isReservedWord(String rule, String name)
          Returns whether a name is considered a reserved word
 String joinNames(IdentifierConfiguration config, IdentifierRule rule, String[] names, String delimiter)
          Join names using a single naming rule and specified delimiter
 String joinNames(IdentifierRule[] rules, String[] names)
          Joins multiple names together using the standard delimiting rules ex.
 String joinNames(IdentifierRule rule, String[] names)
          Joins several names with different naming rules into a single string using appropriate delimiters and separators
 String joinNames(IdentifierRule rule, String[] names, String delimiter)
          Joins several names with different naming rules into a single string using the specified delimiter
 String joinNames(String[] rules, String[] names)
          Joins several names with different naming rules into a single string using appropriate delimiters and separators
 String joinNames(String rule, String[] names)
          Joins several names with different naming rules into a single string using appropriate delimiters and separators
 String joinNames(String rule, String[] names, String delimiter)
          Joins several names with different naming rules into a single string using the specified delimiter
protected  boolean needsConversion(IdentifierConfiguration config)
           
 String removeDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)
           
protected  String removeDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name, String leading, String trailing)
           
 String removeDelimiters(IdentifierConfiguration config, String rule, String name)
          Remove delimiters from a delimited name
 String removeDelimiters(IdentifierRule rule, String name)
          Remove delimiters from a delimited name
 String removeDelimiters(String rule, String name)
          Remove delimiters from a delimited name
 String removeHungarianNotation(IdentifierRule rule, String name)
          Removes Hungarian notation from the specified string.
 String removeHungarianNotation(String rule, String name)
          Removes Hungarian notation from the specified string.
 boolean requiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name)
           
 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
 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
 void setConfiguration(Configuration conf)
          Invoked prior to setting bean properties.
 void setIdentifierConfiguration(IdentifierConfiguration config)
          Set the naming configuration to use for naming operations.
 String[] splitName(IdentifierConfiguration config, IdentifierRule nrule, String name)
           
 String[] splitName(IdentifierConfiguration config, String rule, String name)
           
 String[] splitName(IdentifierRule nrule, String name)
          Splits a combined name name using the provided naming rule
 String[] splitName(IdentifierRule nrule, String name, String nameDelim)
          Splits names using single naming rule and appropriate separators
 String[] splitName(String rule, String name)
          Splits a combined name name using the provided naming rule
 String[] splitName(String nrule, String name, String nameDelim)
          Splits a combined name name using the provided naming rule and delimiter.
 void startConfiguration()
          Invoked before bean property configuration is begun on this object.
 String truncateName(IdentifierRule namingRule, String name, int length)
          Truncates a name while maintaining delimiters.
 String truncateName(String rule, String name, int length)
          Truncates a name while maintaining delimiters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentifierUtilImpl

public IdentifierUtilImpl()

IdentifierUtilImpl

public IdentifierUtilImpl(IdentifierConfiguration config)
Method Detail

setIdentifierConfiguration

public void setIdentifierConfiguration(IdentifierConfiguration config)
Description copied from interface: IdentifierUtil
Set the naming configuration to use for naming operations. A naming configuration must be set before calling any other methods.

Specified by:
setIdentifierConfiguration in interface IdentifierUtil

getIdentifierConfiguration

public IdentifierConfiguration getIdentifierConfiguration()
Description copied from interface: IdentifierUtil
Get the naming configuration.

Specified by:
getIdentifierConfiguration in interface IdentifierUtil

combineNames

public String combineNames(String rule,
                           String name1,
                           String name2)
Description copied from interface: IdentifierUtil
Combines two names using delimiting rules and appropriate separators

Specified by:
combineNames in interface IdentifierUtil

combineNames

public String combineNames(String rule,
                           String[] names)
Description copied from interface: IdentifierUtil
Combines names using the specified delimiting rule and appropriate separators

Specified by:
combineNames in interface IdentifierUtil
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: IdentifierUtil
Combines names using delimiting rules and appropriate separators

Specified by:
combineNames in interface IdentifierUtil
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: IdentifierUtil
Append the names together while maintaining delimiters.

Specified by:
appendNames in interface IdentifierUtil

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:
joinNames in interface IdentifierUtil

joinNames

public String joinNames(String rule,
                        String[] names)
Description copied from interface: IdentifierUtil
Joins several names with different naming rules into a single string using appropriate delimiters and separators

Specified by:
joinNames in interface IdentifierUtil

joinNames

public String joinNames(IdentifierRule rule,
                        String[] names)
Description copied from interface: IdentifierUtil
Joins several names with different naming rules into a single string using appropriate delimiters and separators

Specified by:
joinNames in interface IdentifierUtil

joinNames

public String joinNames(IdentifierRule rule,
                        String[] names,
                        String delimiter)
Description copied from interface: IdentifierUtil
Joins several names with different naming rules into a single string using the specified delimiter

Specified by:
joinNames in interface IdentifierUtil

joinNames

public String joinNames(String rule,
                        String[] names,
                        String delimiter)
Description copied from interface: IdentifierUtil
Joins several names with different naming rules into a single string using the specified delimiter

Specified by:
joinNames in interface IdentifierUtil

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 -
Returns:

splitName

public String[] splitName(IdentifierConfiguration config,
                          IdentifierRule nrule,
                          String name)

splitName

public String[] splitName(IdentifierRule nrule,
                          String name)
Description copied from interface: IdentifierUtil
Splits a combined name name using the provided naming rule

Specified by:
splitName in interface IdentifierUtil
name - 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:
splitName in interface IdentifierUtil
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

Returns:

delimit

public String delimit(IdentifierConfiguration config,
                      IdentifierRule rule,
                      String name)

delimit

public String delimit(IdentifierRule rule,
                      String name)
Description copied from interface: IdentifierUtil
Delimit the name if it requires delimiters

Specified by:
delimit in interface IdentifierUtil
name - 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: IdentifierUtil
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.

Specified by:
delimit in interface IdentifierUtil
name - the name to delimit
force - 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: IdentifierUtil
Determines whether a name is delimited.

Specified by:
isDelimited in interface IdentifierUtil
name - 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: IdentifierUtil
Remove delimiters from a delimited name

Specified by:
removeDelimiters in interface IdentifierUtil
name - the name from which to remove delimiters

removeDelimiters

public String removeDelimiters(IdentifierRule rule,
                               String name)
Description copied from interface: IdentifierUtil
Remove delimiters from a delimited name

Specified by:
removeDelimiters in interface IdentifierUtil
name - 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: IdentifierUtil
Determines whether a name requires delimiters based upon:

Specified by:
requiresDelimiters in interface IdentifierUtil
name - 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:
isReservedWord in interface IdentifierUtil

isReservedWord

public boolean isReservedWord(String rule,
                              String name)
Description copied from interface: IdentifierUtil
Returns whether a name is considered a reserved word

Specified by:
isReservedWord in interface IdentifierUtil

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: IdentifierUtil
Combines names using delimiting rules and appropriate separators

Specified by:
combineNames in interface IdentifierUtil
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: IdentifierUtil
Truncates a name while maintaining delimiters.

Specified by:
truncateName in interface IdentifierUtil

truncateName

public String truncateName(IdentifierRule namingRule,
                           String name,
                           int length)
Description copied from interface: IdentifierUtil
Truncates a name while maintaining delimiters.

Specified by:
truncateName in interface IdentifierUtil

delimit

public String delimit(String rule,
                      String name)
Description copied from interface: IdentifierUtil
Delimit the name if it requires delimiters

Specified by:
delimit in interface IdentifierUtil
name - 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: IdentifierUtil
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.

Specified by:
delimit in interface IdentifierUtil
name - the name to delimit
force - 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: IdentifierUtil
Determines whether a name is delimited.

Specified by:
isDelimited in interface IdentifierUtil
name - the name to examine for delimiters

removeDelimiters

public String removeDelimiters(String rule,
                               String name)
Description copied from interface: IdentifierUtil
Remove delimiters from a delimited name

Specified by:
removeDelimiters in interface IdentifierUtil
name - the name from which to remove delimiters

requiresDelimiters

public boolean requiresDelimiters(String rule,
                                  String name)
Description copied from interface: IdentifierUtil
Determines whether a name requires delimiters based upon:

Specified by:
requiresDelimiters in interface IdentifierUtil
name - 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: IdentifierUtil
Splits a combined name name using the provided naming rule

Specified by:
splitName in interface IdentifierUtil
name - 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: IdentifierUtil
Joins several names with different naming rules into a single string using appropriate delimiters and separators

Specified by:
joinNames in interface IdentifierUtil

appendNames

public String appendNames(String rule,
                          String name1,
                          String name2)
Description copied from interface: IdentifierUtil
Append the names together while maintaining delimiters.

Specified by:
appendNames in interface IdentifierUtil

removeHungarianNotation

public String removeHungarianNotation(IdentifierRule rule,
                                      String name)
Description copied from interface: IdentifierUtil
Removes Hungarian notation from the specified string.

Specified by:
removeHungarianNotation in interface IdentifierUtil

removeHungarianNotation

public String removeHungarianNotation(String rule,
                                      String name)
Description copied from interface: IdentifierUtil
Removes Hungarian notation from the specified string.

Specified by:
removeHungarianNotation in interface IdentifierUtil

splitName

public String[] splitName(String nrule,
                          String name,
                          String nameDelim)
Description copied from interface: IdentifierUtil
Splits a combined name name using the provided naming rule and delimiter.

Specified by:
splitName in interface IdentifierUtil
name - 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: IdentifierUtil
Convert the string using this naming configuration to the supplied naming configuration.

Specified by:
convert in interface IdentifierUtil

convertFull

public String convertFull(IdentifierConfiguration config,
                          String rule,
                          String fullName)
Description copied from interface: IdentifierUtil
Converts a qualified string-based name defined using the base configuration to the specified configuration. Returns the converted name.

Specified by:
convertFull in interface IdentifierUtil

combineFull

public String combineFull(IdentifierConfiguration config,
                          String rule,
                          String fullName)

needsConversion

protected boolean needsConversion(IdentifierConfiguration config)

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.

Specified by:
endConfiguration in interface Configurable

setConfiguration

public void setConfiguration(Configuration conf)
Description copied from interface: Configurable
Invoked prior to setting bean properties.

Specified by:
setConfiguration in interface Configurable

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before bean property configuration is begun on this object.

Specified by:
startConfiguration in interface Configurable

canSplit

public boolean canSplit(String rule,
                        String name)
Description copied from interface: IdentifierUtil
Determines whether a name can be split into multiple components.

Specified by:
canSplit in interface IdentifierUtil

canSplit

public boolean canSplit(IdentifierRule rule,
                        String name)
Description copied from interface: IdentifierUtil
Determines whether a name can be split into multiple components.

Specified by:
canSplit in interface IdentifierUtil

canSplit

public boolean canSplit(String rule,
                        String name,
                        String delim)
Description copied from interface: IdentifierUtil
Determines whether a name can be split into multiple components, taking into account the specified delimiter.

Specified by:
canSplit in interface IdentifierUtil

canSplit

public boolean canSplit(IdentifierRule rule,
                        String name,
                        String delim)
Description copied from interface: IdentifierUtil
Determines whether a name can be split into multiple components, taking into account the specified delimiter.

Specified by:
canSplit in interface IdentifierUtil

combineNames

public String combineNames(IdentifierRule rule,
                           String[] names)
Description copied from interface: IdentifierUtil
Combines names using the specified delimiting rule and appropriate separators

Specified by:
combineNames in interface IdentifierUtil
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: IdentifierUtil
Combines two names using delimiting rules and appropriate separators

Specified by:
combineNames in interface IdentifierUtil


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.