org.hibernate.id.factory.internal
Class DefaultIdentifierGeneratorFactory

java.lang.Object
  extended by org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory
All Implemented Interfaces:
Serializable, IdentifierGeneratorFactory, MutableIdentifierGeneratorFactory, Service, ServiceRegistryAwareService

public class DefaultIdentifierGeneratorFactory
extends Object
implements MutableIdentifierGeneratorFactory, Serializable, ServiceRegistryAwareService

Basic templated support for IdentifierGeneratorFactory implementations.

See Also:
Serialized Form

Constructor Summary
DefaultIdentifierGeneratorFactory()
          Constructs a new DefaultIdentifierGeneratorFactory.
 
Method Summary
 IdentifierGenerator createIdentifierGenerator(String strategy, Type type, Properties config)
          Given a strategy, retrieve the appropriate identifier generator instance.
 Dialect getDialect()
          Get the dialect.
 Class getIdentifierGeneratorClass(String strategy)
          Retrieve the class that will be used as the IdentifierGenerator for the given strategy.
 void injectServices(ServiceRegistryImplementor serviceRegistry)
          Callback to inject the registry.
 void register(String strategy, Class generatorClass)
           
 void setDialect(Dialect dialect)
          Allow injection of the dialect to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIdentifierGeneratorFactory

public DefaultIdentifierGeneratorFactory()
Constructs a new DefaultIdentifierGeneratorFactory.

Method Detail

register

public void register(String strategy,
                     Class generatorClass)
Specified by:
register in interface MutableIdentifierGeneratorFactory

getDialect

public Dialect getDialect()
Description copied from interface: IdentifierGeneratorFactory
Get the dialect.

Specified by:
getDialect in interface IdentifierGeneratorFactory
Returns:
the dialect

setDialect

public void setDialect(Dialect dialect)
Description copied from interface: IdentifierGeneratorFactory
Allow injection of the dialect to use.

Specified by:
setDialect in interface IdentifierGeneratorFactory
Parameters:
dialect - The dialect

createIdentifierGenerator

public IdentifierGenerator createIdentifierGenerator(String strategy,
                                                     Type type,
                                                     Properties config)
Description copied from interface: IdentifierGeneratorFactory
Given a strategy, retrieve the appropriate identifier generator instance.

Specified by:
createIdentifierGenerator in interface IdentifierGeneratorFactory
Parameters:
strategy - The generation strategy.
type - The mapping type for the identifier values.
config - Any configuraion properties given in the generator mapping.
Returns:
The appropriate generator instance.

getIdentifierGeneratorClass

public Class getIdentifierGeneratorClass(String strategy)
Description copied from interface: IdentifierGeneratorFactory
Retrieve the class that will be used as the IdentifierGenerator for the given strategy.

Specified by:
getIdentifierGeneratorClass in interface IdentifierGeneratorFactory
Parameters:
strategy - The strategy
Returns:
The generator class.

injectServices

public void injectServices(ServiceRegistryImplementor serviceRegistry)
Description copied from interface: ServiceRegistryAwareService
Callback to inject the registry.

Specified by:
injectServices in interface ServiceRegistryAwareService
Parameters:
serviceRegistry - The registry


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.