Package org.hibernate.boot.model.naming
Class ObjectNameNormalizer
- java.lang.Object
-
- org.hibernate.boot.model.naming.ObjectNameNormalizer
-
public abstract class ObjectNameNormalizer extends java.lang.ObjectProvides 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 java.lang.StringapplyGlobalQuoting(java.lang.String text)Intended only for use in handling quoting requirements forcolumn-definitionas defined byColumn.columnDefinition(),JoinColumn.columnDefinition(), etc.protected Databasedatabase()IdentifierdetermineLogicalName(java.lang.String explicitName, NamingStrategyHelper namingStrategyHelper)Determine the logical name give a (potentiallynull/empty) explicit name.protected abstract MetadataBuildingContextgetBuildingContext()Access the contextual information related to the current process of building metadata.IdentifiernormalizeIdentifierQuoting(java.lang.String identifierText)Normalizes the quoting of identifiers.IdentifiernormalizeIdentifierQuoting(Identifier identifier)java.lang.StringnormalizeIdentifierQuotingAsString(java.lang.String identifierText)Normalizes the quoting of identifiers.java.lang.StringtoDatabaseIdentifierText(java.lang.String identifierText)
-
-
-
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 inorg.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 (potentiallynull/empty) explicit name.- Parameters:
explicitName- The explicit, user-supplied namenamingStrategyHelper- 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 forcolumn-definitionas 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
-
-