org.apache.openjpa.jdbc.identifier
Class Normalizer

java.lang.Object
  extended by org.apache.openjpa.jdbc.identifier.Normalizer

public class Normalizer
extends Object

Static utility class used for operating on string based identifiers.


Constructor Summary
Normalizer()
           
 
Method Summary
static String append(String name1, String name2)
          Appends one string to another using default identifier rules.
static boolean canSplit(String name)
          Determines whether a name can be split into multiple components.
static boolean canSplit(String name, String delim)
          Determines whether a name can be split into multiple components, taking into account the specified delimiter.
static String combine(String... names)
          Combines multiple names using default identifier rules.
static String combine(String name1, String name2)
          Combines two names using default identifier rules.
static String convert(IdentifierConfiguration config, String rule, String name)
          Convert a normalized name to a name using the specified configuration and naming rule.
static String delimit(String name, boolean force)
          Delimits a string if necessary, optionally forcing it to be delimited.
static boolean fullNamesEqual(String name1, String name2)
          Splits names into individual components and compares individually for equality
static IdentifierConfiguration getNamingConfiguration()
           
static boolean isDelimited(String name)
          Returns true if the name is delimited with default delimiters
static String joinNames(String[] names)
          Joins multiple names using default identifier rules.
static String joinNames(String[] names, String delimiter)
          Joins multiple names using the specified delimiter.
static String joinNames(String name1, String name2)
          Joins two names using the default identifier rules.
static boolean namesEqual(String name1, String name2)
          Compares two string names for equality.
static String normalizeMulti(String name)
          Normalizes a multi-part name
static String normalizeString(String name)
          Normalizes a single part name
static String normalizeUpper(String name)
          Normalizes a name, if not delimited, converts to uppercase.
static String removeDelimiters(String name)
          Removes default delimiters from a string.
static String removeHungarianNotation(String name)
          Removes Hungarian notation from a string.
static String[] splitName(String name)
          Splits a name into normalized components
static String[] splitName(String name, String delim)
          Splits a name into normalized components using the specified name delimiter (ex.
static String truncate(String name, int length)
          Truncates a name to the specified length while maintaining delimiters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Normalizer

public Normalizer()
Method Detail

getNamingConfiguration

public static IdentifierConfiguration getNamingConfiguration()

normalizeMulti

public static String normalizeMulti(String name)
Normalizes a multi-part name

Parameters:
name -
Returns:

normalizeString

public static String normalizeString(String name)
Normalizes a single part name

Parameters:
name -
Returns:

isDelimited

public static boolean isDelimited(String name)
Returns true if the name is delimited with default delimiters

Parameters:
name -
Returns:

fullNamesEqual

public static boolean fullNamesEqual(String name1,
                                     String name2)
Splits names into individual components and compares individually for equality

Parameters:
name1 -
name2 -
Returns:

namesEqual

public static boolean namesEqual(String name1,
                                 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 -
Returns:

normalizeUpper

public static String normalizeUpper(String name)
Normalizes a name, if not delimited, converts to uppercase.

Parameters:
name -
Returns:

splitName

public static String[] splitName(String name)
Splits a name into normalized components

Parameters:
name -
Returns:

splitName

public static String[] splitName(String name,
                                 String delim)
Splits a name into normalized components using the specified name delimiter (ex. schema:table, delim = : --> { schema, table }

Parameters:
name -
Returns:

joinNames

public static String joinNames(String[] names)
Joins multiple names using default identifier rules.

Parameters:
names -
Returns:

joinNames

public static String joinNames(String[] names,
                               String delimiter)
Joins multiple names using the specified delimiter.

Parameters:
names -
Returns:

joinNames

public static String joinNames(String name1,
                               String name2)
Joins two names using the default identifier rules.

Parameters:
names -
Returns:

truncate

public static String truncate(String name,
                              int length)
Truncates a name to the specified length while maintaining delimiters.

Parameters:
name -
length -
Returns:

convert

public static String convert(IdentifierConfiguration config,
                             String rule,
                             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 -
Returns:

combine

public static String combine(String name1,
                             String name2)
Combines two names using default identifier rules.

Parameters:
name1 -
name2 -
Returns:

combine

public static String combine(String... names)
Combines multiple names using default identifier rules.

Parameters:
name1 -
name2 -
Returns:

append

public static String append(String name1,
                            String name2)
Appends one string to another using default identifier rules.

Parameters:
name1 -
name2 -
Returns:

removeHungarianNotation

public static String removeHungarianNotation(String name)
Removes Hungarian notation from a string.

Parameters:
name1 -
name2 -
Returns:

removeDelimiters

public static String removeDelimiters(String name)
Removes default delimiters from a string.

Parameters:
name1 -
name2 -
Returns:

delimit

public static String delimit(String name,
                             boolean force)
Delimits a string if necessary, optionally forcing it to be delimited.

Parameters:
name1 -
name2 -
Returns:

canSplit

public static boolean canSplit(String name)
Determines whether a name can be split into multiple components.

Parameters:
name1 -
name2 -
Returns:

canSplit

public static boolean canSplit(String name,
                               String delim)
Determines whether a name can be split into multiple components, taking into account the specified delimiter.

Parameters:
name1 -
name2 -
Returns:


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