BBjDocsGenerator Overview
In BBj 21.00 and higher, BBj includes a BBjDocsGenerator
utility, which replaces the older BBjToJavadoc
utility. The BBjDocsGenerator
parses documentation blocks in object-oriented BBj program text, and creates API documentation from it. The generated documentation is in HTML format. It supports several command-line parameters that permit each run to be configured differently, permitting customized output from processing one or more BBj source files.
Documentation Blocks in BBj Source Code
BBjDocsGenerator
will process either single or multi-line documentation blocks in a BBj program file.
-
A single-line block contains a single line of BBj code that begins with
REM /**
that ends with*/
. The documentation block includes all of the text between the opening/**
and the closing*/
. -
A multi-line block begins with a single line of BBj code that begins with
REM /**
. It ends with the next line of the formREM <optional text> */
. The documentation block includes all of the text between the/**
on the opening line and the*/
on the closing line.
Note
: since BBj is case-insensitive, the REM
verb can be in any case (upper, lower, or mixed).
The BBjDocsGenerator
identifies and processes description documentation blocks associated with:
-
A package (at the BBj program file level)
-
BBj classes (at the BBj Custom Object class level)
-
BBj class fields (at the BBj Custom Object field level)
-
BBj class methods (at the BBj Custom Object method level)
Tags in Description Documentation Blocks
BBjDocsGenerator
will recognize and process some Javadoc-style
tags that are present in documentation blocks. The following tags are supported:
Tag | Description |
---|---|
@author
|
Defines one or more authors who have contributed to the item being described. |
@version
|
Defines the version identifier for the item being described. |
@param
|
Describes a parameter for a class method. |
@return
|
Describes the value being returned by a class method. |
@see
|
Points to additional documentation that might be helpful in understanding the item being described. |
@since
|
Defines the version or date in which the item being described was added. |
@deprecated
|
Marks the item being described as deprecated. |
In general, the text following one of these tags is free form. The individuals writing the code and adding the tags can include whatever information they choose. Therefore, it is important that they understand where their text will appear, who will see it, and when.
BBjDocsGenerator
also supports markdown features in the documentation blocks, and applies those markdown instructions when it generates the output documentation.
Examples of Documentation Blocks
Some examples of documentation blocks can be seen in this BBj program code:
|
Figure 1. Examples of Documentation Blocks
Specifying a Package in BBj Source Code
BBjDocsGenerator
recognizes documentation blocks as the source of descriptions and details for the output documentation and supports one special instruction: a package specifier.
Defining a package at the top of a BBj Source File causes the documentation generated from that file to be organized into a package (or "namespace" with that name. For example, placing a single line of BBj code that begins with REM PACKAGE <NAME>
at the top of your BBj source file tells the BBjDocsGenerator
to group all of the documentation entries from this file into a single package named <NAME>
. The <NAME>
is white-space delimited (it is the first whole word encountered following REM PACKAGE
).
Note
: since BBj is case-insensitive, the "REM PACKAGE
" text can be in any case (upper, lower, or mixed).
Examples of Package Tags
Some examples of package tags can be seen below (where each block of text represents the text at the top of a different BBj source file):
File #1:
|
File #2:
|
File #3:
|
Figure 2. Examples of Package Tags
Defining these packages at the top of three different BBj Source Files will cause BBjDocsGenerator
to generate its documentation in a matching folder structure. In this example, the main
folder would appear in the output directory, with sub1
and sub2
folders nested beneath it, like this:
<output folder>
+-- main
+------ sub1
+------ sub2
By using this model, you can organize your documentation output in a variety of ways.
Executing BBjDocsGenerator from a BBj Program
To generate documentation files for each of a list of BBj source files, call one of the BBjDocsGenerator.generateBBjdoc()
methods in a BBj program such as the example program shown in Figure 3
.
|
Figure 3. A Simple BBj Program to Run the BBjDocsGenerator
In order to instantiate a BBjDocsGenerator
and a BBjDocsParameters
, BBj must be able to find definitions for those classes. These classes are defined in the BBjDocsGenerator.jar
file that is installed in the <bbj_home>/lib folder beginning with BBj 20.30. For BBj to access that BBjDocsGenerator.jar
file, you must first define a classpath that tells BBj where to find it. For this example, we defined a classpath named docs_generator
in the Enterprise Manager as shown in Figure 4.
Figure 4. The docs_generator Classpath for the BBjDocsGenerator
When including the BBjDocsGenerator
in a BBj program, use the -CPdocs_generator
(classpath) argument to specify the classpath, along with USE
statements similar to those shown in Figure 3
.
Parameters for BBjDocsGenerator.generateBBjDoc()
There are two forms of BBjDocsGenerator.generateBBjdoc()
available, as shown in the table below. Both take an ArrayList
of strings as the first parameter (the list of one or more BBj source files to process), and a string providing the full path to the folder to hold the output documentation files as the second parameter. The third parameter is optional: a BBjDocsParameters
object with one or more parameters set to control how the file(s) are to be processed. The simple BBj program in Figure 3
uses a BBjDocsParameters
variable, params!
, for that purpose.
Return Value | Syntax |
---|---|
void
|
generateBBjDoc(ArrayList<String> list!, String outputDir!) |
void
|
generateBBjDoc(ArrayList<String> list!, String outputDir!, BBjDocsParameter params!) |
Parameter | Description |
---|---|
list! | The list of one or more BBj Source files to process. |
outputDir! | The full path to the directory to hold the output documentation files. |
params! | An optional parameter specifying a BBjDocsParameters object with one or more parameters set to control how the files are to be processed. |
Standard Parameters of BBjDocsParameters
Table 1
: below lists the standard BBjDocsParameters
methods that are available, and the effect of setting each one on the generated documentation files.
Parameter | Methods | Description |
---|---|---|
Author |
|
Controls whether the text following an @author tag is included in the generated documentation. By default, the text following an @author tag is NOT included. |
Bottom Text |
|
Controls writing text as the bottom line of each generated document. By default, there is no bottom text. |
Document Title |
|
Controls writing text as the title of each overview-summary file . By default, there is no title text. |
Document Visibility |
|
Controls the highest level of visibility of items (classes and methods) that will appear in the output documentation. By default, only items with public visibility will appear in the output documentation.
|
Log Path |
|
Controls the full path to the file where the log entries from document generation should be saved, if the Verbose parameter is enabled. By default, no log file is created. |
New Lines |
|
Controls the conversion of newline characters (
|
Deprecated List |
|
Controls the creation of a list of deprecated items when generating the documentation. By default, creating a list of deprecated items is enabled (a list will be created). |
Index Page |
|
Controls the creation of an Index tab in the generated output. By default, creating an index tab is enabled (an index tab will be created). |
Since Tag |
|
Controls whether the text following a @since tag is included in the generated documentation. By default, the text following a @since tag is included. |
Timestamp |
|
Controls the inclusion of a timestamp in the generated output files to indicate when they were generated. By default a timestamp is generated and written into a hidden HTML comment at the beginning of each page. |
Tree |
|
Controls the creation of a tree overview when generating the documentation. By default, creating a tree overview is enabled (a tree overview will be created). |
Stylesheet Path |
|
Controls the full path to a file containing the stylesheet for document generation. By default, no stylesheet file will be used, and the default stylesheet is used instead. |
Top Text |
|
Controls writing text as the top line of each generated document. By default, there is no top text. |
Verbose |
|
Controls whether entries will be written to the log file during documentation generation. By default, verbose is disabled (no log entries are written to the log file).
|
Version |
|
Controls whether the text following a @version tag is included in the generated documentation. By default, the text following a @version tag is NOT included. |
Table 1. The Standard BBjDocsParameters Methods to Customize the BBjDocsGenerator
Advanced Parameters of BBjDocsParameters
Table 2
below lists the advanced BBjDocsParameters
methods that are available, and provides a high-level description of the result on the generated documentation files of setting each one.
Parameter | Methods | Description |
---|---|---|
Class Placeholder List |
|
Manage a list of standard placeholders (substitution tags) to apply when processing classes. |
Class Template |
|
Manage a custom template to be used to display items in the class section. The string passed in is a full path to the file containing the new template. The file is read and its content is stored in this attribute (the path is not stored). |
Deprecated Placeholder List |
|
Manage a list of placeholders (substitution tags) to apply when processing the entries in the deprecated section. |
Deprecated Template |
|
Manage a custom template to be used to display items in the deprecated section. The string passed in is a full path to the file containing the new template. The file is read, and its content is stored in this attribute (the path is not stored). |
Index Placeholder List |
|
Manage a list of placeholders (substitution tags) to apply when processing the entries in the index section. |
Index Template |
|
Manage a custom template to be used to display items in the index section. The string passed in is a full path to the file containing the new template. The file is read and its content is stored in this attribute (the path is not stored). |
Overview Placeholder List |
|
Manage a list of placeholders (substitution tags) to apply when processing the entries in the overview section. |
Overview Template |
|
Manage a custom template to be used to display items in the overview section. The string passed in is a full path to the file containing the new template. The file is read and its content is stored in this attribute (the path is not stored). |
Tree Placeholder List |
|
Manage a list of placeholders (substitution tags) to apply when processing the entries in the tree section. |
Tree Template |
|
Manage a custom template to be used to display items in the tree section. The string passed in is a full path to the file containing the new template. The file is read and its content is stored in this attribute (the path is not stored). |
Use Placeholder List |
|
Manage a list of placeholders (substitution tags) to apply when processing the entries in the use section. |
Use Template |
|
Manage a custom template to be used to display items in the use section. The string passed in is a full path to the file containing the new template. The file is read and its content is stored in this attribute (the path is not stored). |
Table 2. The Advanced BBjDocsParameters Methods to Customize the BBjDocsGenerator
You should not need to use these advanced methods, and thus a detailed explanation of how to use each method is not included here.
Output Files
After successfully running the BBjDocsGenerator
, you will find that it created a collection of files in or under the folder you specified as the outputDir!
argument to generateBBjdoc(list!, outputDir!, params!)
. For example, if you processed exactly one BBj program file, MyClass.bbj
, that contained a comment setting the package as MyPackage
and exactly one class named MyClass
, you would see the following subfolders and files in outputDir!
:
-
allclasses.html
-
allclasses-frame.html
-
deprecated-list.html
-
help.html
-
Index.html
-
index-all.html
-
overview-frame.html
-
overview-summary.html
-
overview-tree.html
-
script.js
-
stylesheet.css
-
class-use (folder)
-
MyClass.html
-
-
MyPackage (folder)
-
MyClass.html
-
package-frame.html
-
package-summary.html
The following sections examine the generated folders and files, and describe the contents of each.
Folder and/or File | Description |
---|---|
allclasses.html | This file contains only a hyperlink-list of each of the classes in this documentation set, without a class description and without using any CSS template or formatting. |
allclasses-frame.html | This file contains a hyperlink-list of each of the classes in this documentation set, without a class description. This page applies the class frame template, so its layout and formatting are based on the CSS and class template files. |
deprecated-list.html | This file contains a list of the classes and methods in this documentation set that have the @deprecated tag. If there are none, this file merely states that. A deprecated class or method is not recommended for use, and if possible a suggested alternative is given. Deprecated items may be removed in future implementations. |
help.html | This file offers explanatory text and other helpful information about BBjDocsGenerator and its logic.
|
index.html | This file lists all of the packages and class files resulting from BBjDocsGenerator processing this documentation set. It includes the output from overview-frame.html and overview-summary.html . |
index-all.html | This file lists all of the class files resulting from BBjDocsGenerator processing this documentation set, grouped by first letter in increasing alphabetic order.
|
overview-frame.html | This file contains a list of all of the packages in this documentation set, and a link to all-classes.html . |
overview-summary.html | This file contains a hyperlink-list of each of the packages in this documentation set, without any description or other details. |
overview-tree.html | This file contains a hyperlink-list of each of the classes in this documentation set, organized hierarchically by package.
|
script.js | This file contains a small number of JavaScript functions used by the other output pages. |
stylesheet.css | This file defines a cascading style sheet whose components are used by a number of the other output pages. |
class-use/ (folder) | This folder holds one file per class, each listing "which other classes in this documentation set use this class". In this context, using a class refers to using the class type for a method argument, field, or return type. |
class-use/MyClass.html | This file contains all of the information available about which other classes in this documentation set use the class MyClass . In this case, there are no other classes, so this file merely states that. If there had been multiple classes, and one or more of those other classes had used the class MyClass as a type, this file would have identified those classes and provided a hyperlink to each.
|
MyPackage/ (folder) |
This folder was created because of the package comment that identified the package as
|
MyPackage/MyClass.html |
Because class MyClass is defined in the BBj program file that also has the
|
MyPackage/package-frame.html | This file contains all of the information available about the package MyPackage , including a hyperlink and a description for each class in MyPackage . This page applies the class frame template, so its layout and formatting are based on the CSS and class template files.
|
MyPackage/package-summary.htm | This file contains only a hyperlink-list of each of the classes in MyPackage , without a class description and without the CSS template or formatting. |
Summary
BBjDocsGenerator
creates an array of output files that together provide documentation that is suitable for your BBj Application Programming Interface (API). It relies upon the BBj program files containing a number of tags with accompanying description text to define the documentation it generates. The BBjDocsGenerator
was created based on the Java concept of Javadoc API documentation. outlined in this document.