Interface IdentifierHelper
- All Known Implementing Classes:
NormalizingIdentifierHelperImpl
public interface IdentifierHelper
Helper for handling
Identifier
instances.-
Method Summary
Modifier and TypeMethodDescriptionapplyGlobalQuoting
(String text) Intended only for use in handling quoting requirements forcolumn-definition
as defined byColumn.columnDefinition()
,JoinColumn.columnDefinition()
, etc.boolean
isReservedWord
(String word) Check whether the given word represents a reserved word.normalizeQuoting
(Identifier identifier) Essentially quotes the identifier if it needs to be.toIdentifier
(String text) Generate an Identifier instance from its simple name as obtained from mapping information.toIdentifier
(String text, boolean quoted) Generate an Identifier instance from its simple name as obtained from mapping information.toMetaDataCatalogName
(Identifier catalogIdentifier) Render the Identifier representation of a catalog name into the String form needed inDatabaseMetaData
calls.toMetaDataObjectName
(Identifier identifier) Render the Identifier representation of an object name (table, sequence, etc) into the String form needed inDatabaseMetaData
calls.toMetaDataSchemaName
(Identifier schemaIdentifier) Render the Identifier representation of a schema name into the String form needed inDatabaseMetaData
calls.
-
Method Details
-
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
- The identifier for which to normalize quoting.- Returns:
- The quoting-normalized Identifier.
-
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
- The text form of a name as obtained from mapping information.- Returns:
- The identifier form of the name.
-
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
- 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
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.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
- The text to be (possibly) quoted- Returns:
- The identifier form
- See Also:
-
isReservedWord
Check whether the given word represents a reserved word.- Parameters:
word
- The word to check- Returns:
true
if the given word represents a reserved word;false
otherwise.
-
toMetaDataCatalogName
Render the Identifier representation of a catalog name into the String form needed inDatabaseMetaData
calls.- Parameters:
catalogIdentifier
- The Identifier representation of a catalog name- Returns:
- The String representation of the given catalog name
-
toMetaDataSchemaName
Render the Identifier representation of a schema name into the String form needed inDatabaseMetaData
calls.- Parameters:
schemaIdentifier
- The Identifier representation of a schema name- Returns:
- The String representation of the given schema name
-
toMetaDataObjectName
Render the Identifier representation of an object name (table, sequence, etc) into the String form needed inDatabaseMetaData
calls.- Parameters:
identifier
- The Identifier representation of an object name- Returns:
- The String representation of the given object name
-