Class NormalizingIdentifierHelperImpl
- java.lang.Object
-
- org.hibernate.engine.jdbc.env.internal.NormalizingIdentifierHelperImpl
-
- All Implemented Interfaces:
IdentifierHelper
public class NormalizingIdentifierHelperImpl extends Object implements IdentifierHelper
-
-
Constructor Summary
Constructors Constructor Description NormalizingIdentifierHelperImpl(JdbcEnvironment jdbcEnvironment, NameQualifierSupport nameQualifierSupport, boolean globallyQuoteIdentifiers, boolean globallyQuoteIdentifiersSkipColumnDefinitions, boolean autoQuoteKeywords, boolean autoQuoteInitialUnderscore, TreeSet<String> reservedWords, IdentifierCaseStrategy unquotedCaseStrategy, IdentifierCaseStrategy quotedCaseStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentifierapplyGlobalQuoting(String text)Intended only for use in handling quoting requirements forcolumn-definitionas defined byColumn.columnDefinition(),JoinColumn.columnDefinition(), etc.booleanisReservedWord(String word)Check whether the given word represents a reserved word.IdentifiernormalizeQuoting(Identifier identifier)Essentially quotes the identifier if it needs to be.IdentifiertoIdentifier(String text)Generate an Identifier instance from its simple name as obtained from mapping information.IdentifiertoIdentifier(String text, boolean quoted)Generate an Identifier instance from its simple name as obtained from mapping information.StringtoMetaDataCatalogName(Identifier identifier)Render the Identifier representation of a catalog name into the String form needed inDatabaseMetaDatacalls.StringtoMetaDataObjectName(Identifier identifier)Render the Identifier representation of an object name (table, sequence, etc) into the String form needed inDatabaseMetaDatacalls.StringtoMetaDataSchemaName(Identifier identifier)Render the Identifier representation of a schema name into the String form needed inDatabaseMetaDatacalls.
-
-
-
Constructor Detail
-
NormalizingIdentifierHelperImpl
public NormalizingIdentifierHelperImpl(JdbcEnvironment jdbcEnvironment, NameQualifierSupport nameQualifierSupport, boolean globallyQuoteIdentifiers, boolean globallyQuoteIdentifiersSkipColumnDefinitions, boolean autoQuoteKeywords, boolean autoQuoteInitialUnderscore, TreeSet<String> reservedWords, IdentifierCaseStrategy unquotedCaseStrategy, IdentifierCaseStrategy quotedCaseStrategy)
-
-
Method Detail
-
normalizeQuoting
public Identifier normalizeQuoting(Identifier identifier)
Description copied from interface:IdentifierHelperEssentially quotes the identifier if it needs to be. Useful to apply global quoting, as well as reserved word quoting after calls to naming strategies.- Specified by:
normalizeQuotingin interfaceIdentifierHelper- Parameters:
identifier- The identifier for which to normalize quoting.- Returns:
- The quoting-normalized Identifier.
-
toIdentifier
public Identifier toIdentifier(String text)
Description copied from interface:IdentifierHelperGenerate an Identifier instance from its simple name as obtained from mapping information.Note that Identifiers returned from here may be implicitly quoted based on 'globally quoted identifiers' or based on reserved words.
- Specified by:
toIdentifierin interfaceIdentifierHelper- Parameters:
text- The text form of a name as obtained from mapping information.- Returns:
- The identifier form of the name.
-
toIdentifier
public Identifier toIdentifier(String text, boolean quoted)
Description copied from interface:IdentifierHelperGenerate an Identifier instance from its simple name as obtained from mapping information. Additionally, this form takes a boolean indicating whether to explicitly quote the Identifier.Note that Identifiers returned from here may be implicitly quoted based on 'globally quoted identifiers' or based on reserved words.
- Specified by:
toIdentifierin interfaceIdentifierHelper- Parameters:
text- The text form of a name as obtained from mapping information.quoted- Is the identifier to be quoted explicitly.- Returns:
- The identifier form of the name.
-
applyGlobalQuoting
public Identifier applyGlobalQuoting(String text)
Description copied from interface:IdentifierHelperIntended 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.This method is needed to account for that fact that the JPA spec says that
column-definitionshould be quoted of global-identifier-quoting is requested. Again, this is needed for spec compliance. TBH, I can not think of a argument why column-definitions should ever be *globally* quoted, but the spec is the spec. In fact the default implementation allows applications to opt-out of global-identifier-quoting affecting column-definitions.- Specified by:
applyGlobalQuotingin interfaceIdentifierHelper- Parameters:
text- The text to be (possibly) quoted- Returns:
- The identifier form
- See Also:
AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONS
-
isReservedWord
public boolean isReservedWord(String word)
Description copied from interface:IdentifierHelperCheck whether the given word represents a reserved word.- Specified by:
isReservedWordin interfaceIdentifierHelper- Parameters:
word- The word to check- Returns:
trueif the given word represents a reserved word;falseotherwise.
-
toMetaDataCatalogName
public String toMetaDataCatalogName(Identifier identifier)
Description copied from interface:IdentifierHelperRender the Identifier representation of a catalog name into the String form needed inDatabaseMetaDatacalls.- Specified by:
toMetaDataCatalogNamein interfaceIdentifierHelper- Parameters:
identifier- The Identifier representation of a catalog name- Returns:
- The String representation of the given catalog name
-
toMetaDataSchemaName
public String toMetaDataSchemaName(Identifier identifier)
Description copied from interface:IdentifierHelperRender the Identifier representation of a schema name into the String form needed inDatabaseMetaDatacalls.- Specified by:
toMetaDataSchemaNamein interfaceIdentifierHelper- Parameters:
identifier- The Identifier representation of a schema name- Returns:
- The String representation of the given schema name
-
toMetaDataObjectName
public String toMetaDataObjectName(Identifier identifier)
Description copied from interface:IdentifierHelperRender the Identifier representation of an object name (table, sequence, etc) into the String form needed inDatabaseMetaDatacalls.- Specified by:
toMetaDataObjectNamein interfaceIdentifierHelper- Parameters:
identifier- The Identifier representation of an object name- Returns:
- The String representation of the given object name
-
-