stubcodegenerator


Experimental Project to create stub code classes/interfaces with packages for actionscript 2 or 3

This is an experimental project. The StubCodeGenerator creates stub code for classes and interfaces together with packages for languages like Java or Actionscript. The default templates target Actionscript3, though.

This software makes use of the ANTLR parser generator and the StringTemplate library, both from Terence Parr. See http://www.antlr.org and http://www.stringtemplate.org/ for details.

If you find bugs or have questions, please use the "Issue" area. This software has been build using Java SE 6. I think you need the JRE 1.5 the least.

StubCodeGenerator takes text files, parses them and creates folders and files based upon, what it finds in the text file. A simple text file for StubCodeGenerator could look like this: c Logger /de /ghost23 c Main i ISomeInterface /subpackage c Specialclass /otherpackage c Otherclass "c" stands for a class, "i" for an interface. Indicate a folder/package with a beginning slash. The indentation is needed for building the desired hierarchy. Indentation has to be done using tabs, not spaces!

To generate stub code, use the StubCodeGenerator.jar like this: c:\java -jar StubCodeGenerator.jar -o c:\outputdirectory sampleinputfile.txt

This will generate the defined folders, classes and interfaces.

StubCodeGenerator uses text template files to generate the stub code for the classes and interfaces. In the binary distribution there is a folder, that has to remain next to the StubCodeGenerator.jar, called "stubcode_templates". There you find text templates for classes and interfaces. You can adjust those to your needs, but you should not rename them. Alternatively you can specify your own templates in a different place (but still with the same file names) by invoking StubCodeGenerator like this: c:\java -jar StubCodeGenerator.jar -o c:\outputdirectory -t c:\folderwithtemplates sampleinputfile.txt When doing so, make sure, that you have a "class_template.st" and "interface_template.st" in that folder. Within the templates, you'll see placeholders, like "$className$". These will be replaced by the respective values during stub code generation.

You can also define your own placeholders. For example, see this input file: ``` author="Sven Busse"

c Logger /de /ghost23 c Main i ISomeInterface ```

Now you can place a placeholder "$author$" somewhere in your templates and StubCodeGenerator will put the respective value in there.

Lastly you can specify individual templates for your classes/interfaces: ``` author="Sven Busse"

c Logger /de /ghost23 c Main t "special_class_template" i ISomeInterface ``` Now you have to make sure, that within the specified location for your templates or in the "stubcode_templates" folder you have added a "special_class_template.st" file (note, as you can see above, you leave out the ".st" in the input file).

Project Information

Labels:
stubcode generator actionscript java antlr stringtemplate