| Writers Overview |
|
Writers are used to write files or execute Java code, such as compilation, or deployment. There are many types of Writers, this section deals with the interfaces and super classes.
Specific Writers are covered further in their respective sections. |
|
Class Hierarchy The top-level Writer class hierarchy is illustrated below: -
|
|
Dictionary Writer(com.javelin.generator.DictionaryWriter) The Dictionary Writer is the interface that is used to write out code. The Dictionary Writer has the following properties, which are set on the Dictionary Writer before a command to write the file is called.
Writers are declared in the bdf as follows: - [#]writer.[#]<index>=<fully qualified class name> The # comment at the beginning of a line can be used to stop executing the writers at that point in the index. The # comment before the index stops just those writers being executed. For example: - writer.0=com.javelin.generator.beans.BeanInterfaceWriter One or more arguments can be passed to a Dictionary Writer, as space separated Strings. For example: - writer.0=com.javelin.generator.beans.BeanInterfaceWriter
Arg1 Arg2 arg3 If the fully qualified class is not a Dictionary Writer JGenerator tries to find a main method to call, and pass the arguments to it, before calling the write method. |
|
Abstract Writer (com.javelin.generator.AbstractWriter) The Abstract Writer is a helper class that Writers can extend to get some basic functionality. The Abstract Writer has the following functionality:-
|
|
Copyright By default the AbstractWriter writes out version copyright for all files. By default the copyright has the following syntax: - <ClassName>.Copyright=<Copyright> If this property is not found the following property is used: - copyright=<Copyright> |
|
Title Comments By default the AbstractWriter writes out title comments for all files. By default the title comment has the following syntax: - <ClassName>.titleComment=<Comment> If this property is not found "No Comment" is written. For example the following property: - AddressSession.titleComment=Interface for finding Address. Will write the following in the Java headers: - * Interface for saving, finding and removing an Address. |
|
Authorship By default the AbstractWriter writes out authorship comments for all files. By default the author has the following syntax: - <ClassName>.Author=<Author> If this property is not found the following property is used: - Author=<Author> For example the following property: - MyTable.Author=Javelin Software Will write the following in the MyTable java header: - * @author Javelin Software |
|
Version By default the AbstractWriter writes out version comments for all files. By default the version has the following syntax: - <ClassName>.Version=<Version> If this property is not found the following property is used: - Version=<Version> For example the following property: - Version=<1.0> Will write the following in the Java headers: - * @version 1.0 |
|
Imports Imports can be added to remove ambigities. Imports can be added to all files using the syntax: import.<N>=<import> If this property is not found the following property is used: - [<ClassName>.]import.<N>=<import>
|
|
Aggregate Writer(com.javelin.generator.AggregateWriter) Aggregate Writers are used to call sets of predefined Writers with one command. Aggregate Writers are called with a single name argument, used to refer to a named set of writers. Calling sets of writers with one call keeps the list of writers being called down to a minimum. This allows developers to easily skip complete sets of writers with one comment. This code sets up a set of writers with the name customwriters: - customwriters.writer.0=com.javelin.generator.beans.BeanInterfaceWriter The custom writers can then be called once, as follows:- writer.0=com.javelin.generator.AggregateWriter customwriters The defaultdbf.properties file defines sets of Writers for different modules.
|