Package org.hibernate.boot.model.naming
Class ObjectNameNormalizer
- java.lang.Object
-
- org.hibernate.boot.model.naming.ObjectNameNormalizer
-
public abstract class ObjectNameNormalizer extends Object
Provides centralized normalization of how database object names are handled.
-
-
Constructor Summary
Constructors Constructor Description ObjectNameNormalizer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
applyGlobalQuoting(String text)
Intended only for use in handling quoting requirements forcolumn-definition
as defined byColumn.columnDefinition()
,JoinColumn.columnDefinition()
, etc.protected Database
database()
Identifier
determineLogicalName(String explicitName, NamingStrategyHelper namingStrategyHelper)
Determine the logical name give a (potentiallynull
/empty) explicit name.protected abstract MetadataBuildingContext
getBuildingContext()
Access the contextual information related to the current process of building metadata.Identifier
normalizeIdentifierQuoting(String identifierText)
Normalizes the quoting of identifiers.Identifier
normalizeIdentifierQuoting(Identifier identifier)
String
normalizeIdentifierQuotingAsString(String identifierText)
Normalizes the quoting of identifiers.String
toDatabaseIdentifierText(String identifierText)
-
-
-
Method Detail
-
normalizeIdentifierQuoting
public Identifier normalizeIdentifierQuoting(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 String normalizeIdentifierQuotingAsString(String identifierText)
Normalizes the quoting of identifiers. This form returns a String rather than an Identifier to better work with the legacy code inorg.hibernate.mapping
- Parameters:
identifierText
- The identifier to be quoting-normalized.- Returns:
- The identifier accounting for any quoting that need be applied.
-
determineLogicalName
public Identifier determineLogicalName(String explicitName, NamingStrategyHelper namingStrategyHelper)
Determine the logical name give a (potentiallynull
/empty) explicit name.- Parameters:
explicitName
- The explicit, user-supplied namenamingStrategyHelper
- The naming strategy helper.- Returns:
- The logical name
-
applyGlobalQuoting
public String applyGlobalQuoting(String text)
Intended only for use in handling quoting requirements forcolumn-definition
as defined byColumn.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
-
getBuildingContext
protected abstract MetadataBuildingContext getBuildingContext()
Access the contextual information related to the current process of building metadata. Here, that typically might be needed for accessing:- Returns:
- The current building context
-
-