Package org.castor.ddlgen.keygenerator
Class SequenceKeyGeneratorFactory
java.lang.Object
org.castor.ddlgen.keygenerator.SequenceKeyGeneratorFactory
- All Implemented Interfaces:
KeyGeneratorFactory
- Direct Known Subclasses:
Db2SequenceKeyGeneratorFactory,HsqlSequenceKeyGeneratorFactory,OracleSequenceKeyGeneratorFactory,PostgresqlSequenceKeyGeneratorFactory,SapdbSequenceKeyGeneratorFactory
Abstract base class for SEQUENCE key generator factories.
- Since:
- 1.1
- Version:
- $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Le Duc Bao, Ralf Joachim
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal KeyGeneratorCreate a default key generator instance with the algorithm the factory is responsible for.final KeyGeneratorcreateKeyGenerator(KeyGeneratorDef definition) Create a key generator instance from the given definition with the algorithm the factory is responsible for.final StringGet name of key generator algorithm.final booleanDoes the algorithm has mandatory parameters and therefore requires a key generator definition in mapping file?abstract voidtoCreateDDL(KeyGenerator key, DDLWriter writer) Generate create script for given SEQUENCE key generator.abstract voidtoDropDDL(KeyGenerator key, DDLWriter writer) Generate drop script for given SEQUENCE key generator.protected final StringtoPrimaryKeyList(Table table) Build a string containing names of all primary key columns separated by '_'.protected final StringtoPrimaryKeyTypeList(Table table) Build a string containing types of all primary key columns separated by '_'.
-
Constructor Details
-
SequenceKeyGeneratorFactory
public SequenceKeyGeneratorFactory()
-
-
Method Details
-
getAlgorithmName
Get name of key generator algorithm.- Specified by:
getAlgorithmNamein interfaceKeyGeneratorFactory- Returns:
- Name of key generator algorithm.
-
hasMandatoryParameters
public final boolean hasMandatoryParameters()Does the algorithm has mandatory parameters and therefore requires a key generator definition in mapping file?- Specified by:
hasMandatoryParametersin interfaceKeyGeneratorFactory- Returns:
trueif algorithm has mandatory parameters and therefore requires a key generator definition in mapping file.falseif algorithm does not require parameters or has only optional parameters.
-
createKeyGenerator
Create a default key generator instance with the algorithm the factory is responsible for. This is only possible for those algorithms that do not require mandatory parameters.- Specified by:
createKeyGeneratorin interfaceKeyGeneratorFactory- Returns:
- A default key generator instance with the algorithm the factory is responsible for.
- Throws:
GeneratorException- If creation of default key generator is not possible due to required mandatory parameters.
-
createKeyGenerator
Create a key generator instance from the given definition with the algorithm the factory is responsible for.- Specified by:
createKeyGeneratorin interfaceKeyGeneratorFactory- Parameters:
definition- The definition to initialize the key generator.- Returns:
- A key generator instance initialized with given definition with the algorithm the factory is responsible for.
- Throws:
GeneratorException- If failed to create a key generator instance.
-
toCreateDDL
Generate create script for given SEQUENCE key generator.- Parameters:
key- SEQUENCE key generator to generate DDL for.writer- DDLWriter to write schema objects to.
-
toDropDDL
Generate drop script for given SEQUENCE key generator.- Parameters:
key- SEQUENCE key generator to generate DDL for.writer- DDLWriter to write schema objects to.
-
toPrimaryKeyList
Build a string containing names of all primary key columns separated by '_'.- Parameters:
table- Table build primary key column names string for.- Returns:
- String containing names of all primary key columns separated by '_'.
-
toPrimaryKeyTypeList
Build a string containing types of all primary key columns separated by '_'.- Parameters:
table- Table build primary key column types string for.- Returns:
- String containing types of all primary key columns separated by '_'.
-