Top Fields Constructors Methods
org.hibernate.engine.jdbc.env.internal

public Class NormalizingIdentifierHelperImpl

extends Object
implements IdentifierHelper
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.jdbc.env.spi.IdentifierHelper
Imports
java.util.Locale, .TreeSet, org.hibernate.AssertionFailure, org.hibernate.boot.model.naming.DatabaseIdentifier, .Identifier, org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy, .IdentifierHelper, .JdbcEnvironment, .NameQualifierSupport, org.jboss.logging.Logger

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
private final boolean
private final JdbcEnvironment
private static final Logger
private final NameQualifierSupport
private final IdentifierCaseStrategy
private final TreeSet<String>
private final IdentifierCaseStrategy

Constructor Summary

AccessConstructor and Description
public
NormalizingIdentifierHelperImpl(JdbcEnvironment jdbcEnvironment, NameQualifierSupport nameQualifierSupport, boolean globallyQuoteIdentifiers, boolean globallyQuoteIdentifiersSkipColumnDefinitions, boolean autoQuoteKeywords, TreeSet<String> reservedWords, IdentifierCaseStrategy unquotedCaseStrategy, IdentifierCaseStrategy quotedCaseStrategy)

Method Summary

Modifier and TypeMethod and Description
public Identifier
applyGlobalQuoting(String
The text to be (possibly) quoted
text
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.applyGlobalQuoting.

Intended only for use in handling quoting requirements for column-definition as defined by javax.persistence.Column#columnDefinition(), javax.persistence.JoinColumn#columnDefinition, etc. This method should not be called in any other scenario.
public boolean
isReservedWord(String
The word to check
word
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.isReservedWord.

Check whether the given word represents a reserved word.
public Identifier
normalizeQuoting(Identifier
The identifier for which to normalize quoting.
identifier
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.normalizeQuoting.

Essentially quotes the identifier if it needs to be.
public Identifier
toIdentifier(String
The text form of a name as obtained from mapping information.
text
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Generate an Identifier instance from its simple name as obtained from mapping information.
public Identifier
toIdentifier(String
The text form of a name as obtained from mapping information.
text
,
boolean
Is the identifier to be quoted explicitly.
quoted
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Generate an Identifier instance from its simple name as obtained from mapping information.
public String
toMetaDataCatalogName(Identifier
The Identifier representation of a catalog name
identifier
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataCatalogName.

Render the Identifier representation of a catalog name into the String form needed in java.sql.DatabaseMetaData calls.
public String
toMetaDataObjectName(Identifier
The Identifier representation of an object name
identifier
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataObjectName.

Render the Identifier representation of an object name (table, sequence, etc) into the String form needed in java.sql.DatabaseMetaData calls.
public String
toMetaDataSchemaName(Identifier
The Identifier representation of a schema name
identifier
)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataSchemaName.

Render the Identifier representation of a schema name into the String form needed in java.sql.DatabaseMetaData calls.
private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoQuoteKeywordsback to summary
private final boolean autoQuoteKeywords
globallyQuoteIdentifiersback to summary
private final boolean globallyQuoteIdentifiers
globallyQuoteIdentifiersSkipColumnDefinitionsback to summary
private final boolean globallyQuoteIdentifiersSkipColumnDefinitions
jdbcEnvironmentback to summary
private final JdbcEnvironment jdbcEnvironment
logback to summary
private static final Logger log
nameQualifierSupportback to summary
private final NameQualifierSupport nameQualifierSupport
quotedCaseStrategyback to summary
private final IdentifierCaseStrategy quotedCaseStrategy
reservedWordsback to summary
private final TreeSet<String> reservedWords
unquotedCaseStrategyback to summary
private final IdentifierCaseStrategy unquotedCaseStrategy

Constructor Detail

NormalizingIdentifierHelperImplback to summary
public NormalizingIdentifierHelperImpl(JdbcEnvironment jdbcEnvironment, NameQualifierSupport nameQualifierSupport, boolean globallyQuoteIdentifiers, boolean globallyQuoteIdentifiersSkipColumnDefinitions, boolean autoQuoteKeywords, TreeSet<String> reservedWords, IdentifierCaseStrategy unquotedCaseStrategy, IdentifierCaseStrategy quotedCaseStrategy)

Method Detail

applyGlobalQuotingback to summary
public Identifier applyGlobalQuoting(String text)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.applyGlobalQuoting.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.applyGlobalQuoting.

Intended only for use in handling quoting requirements for column-definition as defined by javax.persistence.Column#columnDefinition(), javax.persistence.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-definition should 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.

Parameters
text:String

The text to be (possibly) quoted

Returns:Identifier

The identifier form

Annotations
@Override
isReservedWordback to summary
public boolean isReservedWord(String word)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.isReservedWord.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.isReservedWord.

Check whether the given word represents a reserved word.

Parameters
word:String

The word to check

Returns:boolean

true if the given word represents a reserved word; false otherwise.

Annotations
@Override
normalizeQuotingback to summary
public Identifier normalizeQuoting(Identifier identifier)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.normalizeQuoting.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.normalizeQuoting.

Essentially quotes the identifier if it needs to be. Useful to apply global quoting, as well as reserved word quoting after calls to naming strategies.

Parameters
identifier:Identifier

The identifier for which to normalize quoting.

Returns:Identifier

The quoting-normalized Identifier.

Annotations
@Override
toIdentifierback to summary
public Identifier toIdentifier(String text)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Generate 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.

Parameters
text:String

The text form of a name as obtained from mapping information.

Returns:Identifier

The identifier form of the name.

Annotations
@Override
toIdentifierback to summary
public Identifier toIdentifier(String text, boolean quoted)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toIdentifier.

Generate 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.

Parameters
text:String

The text form of a name as obtained from mapping information.

quoted:boolean

Is the identifier to be quoted explicitly.

Returns:Identifier

The identifier form of the name.

Annotations
@Override
toMetaDataCatalogNameback to summary
public String toMetaDataCatalogName(Identifier identifier)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataCatalogName.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataCatalogName.

Render the Identifier representation of a catalog name into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
identifier:Identifier

The Identifier representation of a catalog name

Returns:String

The String representation of the given catalog name

Annotations
@Override
toMetaDataObjectNameback to summary
public String toMetaDataObjectName(Identifier identifier)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataObjectName.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataObjectName.

Render the Identifier representation of an object name (table, sequence, etc) into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
identifier:Identifier

The Identifier representation of an object name

Returns:String

The String representation of the given object name

Annotations
@Override
toMetaDataSchemaNameback to summary
public String toMetaDataSchemaName(Identifier identifier)

Implements org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataSchemaName.

Doc from org.hibernate.engine.jdbc.env.spi.IdentifierHelper.toMetaDataSchemaName.

Render the Identifier representation of a schema name into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
identifier:Identifier

The Identifier representation of a schema name

Returns:String

The String representation of the given schema name

Annotations
@Override
toMetaDataTextback to summary
private String toMetaDataText(Identifier identifier)