org.hibernate.id.factory
Class DefaultIdentifierGeneratorFactory

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

public class DefaultIdentifierGeneratorFactory
extends Object
implements IdentifierGeneratorFactory, Serializable

Basic templated support for IdentifierGeneratorFactory implementations.

Author:
Steve Ebersole
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.
 Class getIdentifierGeneratorClass(String strategy)
          Retrieve the class that will be used as the IdentifierGenerator for the given strategy.
 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

setDialect

public void setDialect(Dialect dialect)
Allow injection of the dialect to use.

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

register

public void register(String strategy,
                     Class generatorClass)

createIdentifierGenerator

public IdentifierGenerator createIdentifierGenerator(String strategy,
                                                     Type type,
                                                     Properties config)
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)
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.


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