Generator configuration
Javadoc
The javadoc of the original method and interface/class will considered. Each Java file which is created by the generator has a well formed javadoc.
The generator consider the following javadoc tags:
@generator.ignore
: This tag in the method or class javadoc tells the generator to ignore the method or the whole class.
@generator.precondition
: This tag defines an additional parameter in the method (multiple precondition parameters are allowed!)Example:
package my.dao; ... /** * ... * @generator.precondition Integer The number */ public void update();
The generator creates the following output:
package my.dao; ... /** * ... * @param integer The number */ public void update( Integer integer ) throws RemoteException
If the example above is defined like this:
@generator.precondition Integer(number) The number
the generator creates the following output:
package my.dao; ... /** * ... * @param number The number */ public void update( Integer number ) throws RemoteException
If the precondition parameter contains only the class name (like in the example) and the class is defined in an other package and is not a class from the java.lang package then an import mapping entry should be added to organise the import statements properly. If the parameter is full qualified, then no additional import mapping is required.
Example:
package my.dao; ... /** * ... * @generator.precondition Collection(numbers) */ ...
Import mapping entry for the configuration looks like:
javaGenerator.import.java.util.Collection = true
@generator.ignoreParameter
: This tag ignores a parameter of the method.
Example:
package my.dao; ... /** * ... * @generator.ignoreParameter myName */
@generator.return
: This tag overwrite the return value of the method.
Example:
package my.dao; ... /** * ... * @generator.return String the value */
@generator.exception
: This tag defines an additional exception of the method.
Example:
package my.dao; ... /** * ... * @generator.exception IOException ... */
@generator.subpackage
: This tag force for the defined method to create a subpackage. The name of the subpackage is followed after the@generator.subpackage
definition (see also package mapping).
Example:
package my.dao; ... /** * ... * @generator.subpackage testdata */
The generator creates in the
test
package a subpackagetestdata
.
The generator also supports DAO specific tags which are only considered by the DAO generator. To use this feature insert after
the @generator
the tag dao
followed by a generator tag (see above).
Example:
package my.dao; ... /** * ... * @generator.dao.return String the value * @generator.dao.exception FileNotFoundException * @generator.dao.subpackage testdata */
Configuration file
The generator use the jptools Java file parser and the class JavaFileFormatter
to format the generated code. The documentation of the generator configuration you can find in the table below. The formatter and the
generator configuration are placed in one file.
All formatter and generator configuration of the different generators like EJBGenerator, DAOFileGenerator, ProcessorGenerator and the ValueObjectGenerator can placed in one file. Generator specific configuration can be defined with their special key (EJBGenerator=ejb, DAOFileGenerator=dao, ProcessorGenerator=sql, ValueObjectGenerator=vo). Have a look in the example configuration!
The follwing file defines the default configuration: Formatter and Generator configuration example.
The following table shows the generator configuration documentation:
Key |
Default value |
Description |
---|---|---|
|
|
Defines the header name of the abstract super classes |
|
|
Defines the trailer name of the abstract super classes |
|
Defines the header name of the classes |
|
|
|
Defines the trailer name of the classes |
|
|
Flag to enable creating abstract super classes in each package. |
|
|
Defines the superclass of the DAO bean classes. |
|
|
Defines the super class of the test case classes |
|
|
Defines the trailer name of an EJB home interface |
|
Defines the trailer name of an EJB remote interface |
|
|
|
Defines the name trailer of an EJB implemenation class |
|
|
Flag to enable creating testclasses for each bean. |
|
|
Flag to enable creating super testclasses for each test package. |
|
|
Flag to enable creating logger instance in the generated classes. example:
|
|
|
Flag to enable creating version attribute instance in the generated classes. example:
|
|
|
Defines the name of the subpackage for testclasses. |
|
|
Insert precondition parameter before the existing parameters. |
|
|
Defines the method level to ignore methods. The following levels are valid:
As exmple the level protected ignores the protected and private methods. |
|
|
The package mapping allows to map to another package.
Example: |
|
|
The import mapping helps to organise the import statements properly.
Example:
|
|
The exception mapping allows to change an existing javadoc description of a defined
exception or to eliminate an exception of the throws declaration.
Example: defines a new javadoc text of the exception Example: removes the |
|
|
|
The keyword mapping guarantees to have well written keywords.
Example: |