/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.model.naming;
import org.hibernate.boot.spi.MetadataBuildingContext;
Helper contract for dealing with naming strategies.
/**
* Helper contract for dealing with naming strategies.
*/
public interface NamingStrategyHelper {
Called when the user supplied no explicit name/identifier for the given database object.
Typically implementations will access the ImplicitNamingStrategy
via MetadataBuildingContext.getBuildingOptions()
-> MetadataBuildingOptions.getImplicitNamingStrategy()
For proper quoting, Database.toIdentifier(String)
should be used via MetadataBuildingContext.getMetadataCollector()
-> Metadata.getDatabase()
Params: - buildingContext – The building context in which this is called.
Returns: The implicit name
/**
* Called when the user supplied no explicit name/identifier for the given database object.
* <p/>
* Typically implementations will access the {@link ImplicitNamingStrategy} via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getBuildingOptions()} ->
* {@link org.hibernate.boot.spi.MetadataBuildingOptions#getImplicitNamingStrategy()}
* <p/>
* For proper quoting, {@link org.hibernate.boot.model.relational.Database#toIdentifier(String)}
* should be used via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getMetadataCollector()} ->
* {@link org.hibernate.boot.spi.InFlightMetadataCollector#getDatabase()}
*
* @param buildingContext The building context in which this is called.
*
* @return The implicit name
*/
public Identifier determineImplicitName(MetadataBuildingContext buildingContext);
Called when the user has supplied an explicit name for the database object.
Typically implementations will access the ImplicitNamingStrategy
via MetadataBuildingContext.getBuildingOptions()
-> MetadataBuildingOptions.getImplicitNamingStrategy()
For proper quoting, Database.toIdentifier(String)
should be used via MetadataBuildingContext.getMetadataCollector()
-> Metadata.getDatabase()
Params: - explicitName – The explicit object name.
- buildingContext – The building context in which this is called.
Returns: The strategy-handled name.
/**
* Called when the user has supplied an explicit name for the database object.
* <p/>
* Typically implementations will access the {@link ImplicitNamingStrategy} via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getBuildingOptions()} ->
* {@link org.hibernate.boot.spi.MetadataBuildingOptions#getImplicitNamingStrategy()}
* <p/>
* For proper quoting, {@link org.hibernate.boot.model.relational.Database#toIdentifier(String)}
* should be used via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getMetadataCollector()} ->
* {@link org.hibernate.boot.spi.InFlightMetadataCollector#getDatabase()}
*
* @param explicitName The explicit object name.
* @param buildingContext The building context in which this is called.
*
* @return The strategy-handled name.
*/
public Identifier handleExplicitName(String explicitName, MetadataBuildingContext buildingContext);
Handle converting a logical name to a physical name
Typically implementations will access the PhysicalNamingStrategy
via MetadataBuildingContext.getBuildingOptions()
-> MetadataBuildingOptions.getPhysicalNamingStrategy()
For proper quoting, Database.toIdentifier(String)
should be used via MetadataBuildingContext.getMetadataCollector()
-> Metadata.getDatabase()
Params: - logicalName – The logical name to convert to a physical name
- buildingContext – The building context in which this is called.
Returns: The physical name
/**
* Handle converting a logical name to a physical name
* <p/>
* Typically implementations will access the {@link PhysicalNamingStrategy} via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getBuildingOptions()} ->
* {@link org.hibernate.boot.spi.MetadataBuildingOptions#getPhysicalNamingStrategy()}
* <p/>
* For proper quoting, {@link org.hibernate.boot.model.relational.Database#toIdentifier(String)}
* should be used via
* {@link org.hibernate.boot.spi.MetadataBuildingContext#getMetadataCollector()} ->
* {@link org.hibernate.boot.spi.InFlightMetadataCollector#getDatabase()}
*
* @param logicalName The logical name to convert to a physical name
* @param buildingContext The building context in which this is called.
*
* @return The physical name
*/
public Identifier toPhysicalName(Identifier logicalName, MetadataBuildingContext buildingContext);
}