Class ObjectNameNormalizer


  • public abstract class ObjectNameNormalizer
    extends java.lang.Object
    Provides centralized normalization of how database object names are handled.
    • Constructor Detail

      • ObjectNameNormalizer

        public ObjectNameNormalizer()
    • Method Detail

      • normalizeIdentifierQuoting

        public Identifier normalizeIdentifierQuoting​(java.lang.String identifierText)
        Normalizes the quoting of identifiers.

        This implements the rules set forth in JPA 2 (section "2.13 Naming of Database Objects") which states that the double-quote (") is the character which should be used to denote a quoted identifier. Here, we handle recognizing that and converting it to the more elegant backtick (`) approach used in Hibernate.. Additionally we account for applying what JPA2 terms "globally quoted identifiers".

        Parameters:
        identifierText - The identifier to be quoting-normalized.
        Returns:
        The identifier accounting for any quoting that need be applied.
      • database

        protected Database database()
      • normalizeIdentifierQuoting

        public Identifier normalizeIdentifierQuoting​(Identifier identifier)
      • normalizeIdentifierQuotingAsString

        public java.lang.String normalizeIdentifierQuotingAsString​(java.lang.String identifierText)
        Normalizes the quoting of identifiers. This form returns a String rather than an Identifier to better work with the legacy code in org.hibernate.mapping
        Parameters:
        identifierText - The identifier to be quoting-normalized.
        Returns:
        The identifier accounting for any quoting that need be applied.
      • toDatabaseIdentifierText

        public java.lang.String toDatabaseIdentifierText​(java.lang.String identifierText)
      • determineLogicalName

        public Identifier determineLogicalName​(java.lang.String explicitName,
                                               NamingStrategyHelper namingStrategyHelper)
        Determine the logical name give a (potentially null/empty) explicit name.
        Parameters:
        explicitName - The explicit, user-supplied name
        namingStrategyHelper - The naming strategy helper.
        Returns:
        The logical name
      • applyGlobalQuoting

        public java.lang.String applyGlobalQuoting​(java.lang.String text)
        Intended only for use in handling quoting requirements for column-definition as defined by Column.columnDefinition(), JoinColumn.columnDefinition(), etc. This method should not be called in any other scenario.
        Parameters:
        text - The specified column definition
        Returns:
        The name with global quoting applied