Name
Java::Doc - Extract documentation from Java source code.
Synopsis
use Java::Doc;
my $j = Java::Doc::new;
$j->source = [qw(/home/phil/z/java/layoutText/LayoutText.java)];
$j->target = qq(/home/phil/z/java/documentation.html);
$j->html;
Each source file is parsed for documentation information which is then collated into one cross referenced html file.
Documentation is extracted for packages, classes, methods.
Packages
Lines matching
package <packageName> ;
are assumed to define packages.
Classes
Lines matching:
public class <className> // <comment>
public class <className> { // <comment>
with any { being ignored, are assumed to define a class with the description of the class contained in the text of the comment extending to the end of the line.
Methods
Methods are specified by lines matching:
public <type> <methodName> () // <comment>
public <type> <methodName> // <comment>
public <type> <methodName> ( // <comment>
with the description of the method contained in the text of the comment extending to the end of the line.
If '()' is present on the line the method is assumed to have no parameters. Otherwise the parameter descriptions follow one per line on subsequent lines that match:
[(]final <type> <parameterName> [,){] // <comment>
with any leading ( or trailing ), ,, { being ignored, are assumed to be parameter definitions for the method with the description of the parameter held in the comment.
Example
The following fragment of java code provides an example of documentation held as comments that can be processed by this module:
package com.appaapps;
public class LayoutText // Layout text on a canvas
{public static void draw // Draw text to fill a fractional area of the canvas
(final Canvas canvas){ // Canvas to draw on
Description
The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.
Attributes
Attributes that can be set or retrieved by assignment
source :lvalue
A reference to an array of Java source files that contain documentation as well as java
target :lvalue
Name of the file to contain the generated documentation
wellKnownClasses :lvalue
Reference to an array of urls that contain the class name of well known Java classes such as: TreeMap which will be used in place of the class name to make it possible to locate definitions of these other classes.
Methods
Methods available
new()
Create a new java doc processor
html($)
Create documentation using html as the output format. Write the generated html to the file specified by target if any and returtn the generated html as an array of lines.
1 $javaDoc Java doc processor
Index
1 html
2 new
3 source
4 target
Installation
This module is written in 100% Pure Perl and, thus, it is easy to read, use, modify and install.
Standard Module::Build process for building and installing modules:
perl Build.PL
./Build
./Build test
./Build install
Author
Copyright
Copyright (c) 2016-2017 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.