Class Normalizer

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

public class Normalizer extends Object
Static utility class used for operating on string based identifiers.
  • Constructor Details

    • Normalizer

      public Normalizer()
  • Method Details

    • getNamingConfiguration

      public static IdentifierConfiguration getNamingConfiguration()
    • normalizeMulti

      public static String normalizeMulti(String name)
      Normalizes a multi-part name
      Parameters:
      name -
    • normalizeString

      public static String normalizeString(String name)
      Normalizes a single part name
      Parameters:
      name -
    • isDelimited

      public static boolean isDelimited(String name)
      Returns true if the name is delimited with default delimiters
      Parameters:
      name -
    • fullNamesEqual

      public static boolean fullNamesEqual(String name1, String name2)
      Splits names into individual components and compares individually for equality
      Parameters:
      name1 -
      name2 -
    • 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 -
    • normalizeUpper

      public static String normalizeUpper(String name)
      Normalizes a name, if not delimited, converts to uppercase.
      Parameters:
      name -
    • splitName

      public static String[] splitName(String name)
      Splits a name into normalized components
      Parameters:
      name -
    • 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 -
    • joinNames

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

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

      public static String joinNames(String name1, String name2)
      Joins two names using the default identifier rules.
      Parameters:
      names -
    • truncate

      public static String truncate(String name, int length)
      Truncates a name to the specified length while maintaining delimiters.
      Parameters:
      name -
      length -
    • 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 -
    • combine

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

      public static String combine(String... names)
      Combines multiple names using default identifier rules.
      Parameters:
      name1 -
      name2 -
    • append

      public static String append(String name1, String name2)
      Appends one string to another using default identifier rules.
      Parameters:
      name1 -
      name2 -
    • removeHungarianNotation

      public static String removeHungarianNotation(String name)
      Removes Hungarian notation from a string.
      Parameters:
      name1 -
      name2 -
    • removeDelimiters

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

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

      public static boolean canSplit(String name)
      Determines whether a name can be split into multiple components.
    • 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.