Java::Doc - Extract documentation from Java source code.
use Java::Doc; my $j = Java::Doc::new; # New document builder $j->source = [qw(~/java/layoutText/LayoutText.java)]; # Source files $j->target = qq(~/java/documentation.html); # Output html $j->indent = 20; # Indentation $j->colors = [map {"#$_"} qw(ccFFFF FFccFF FFFFcc # Colours CCccFF FFCCcc ccFFCC)]; $j->html; # Create html
Each source file is parsed for documentation information which is then collated into a colorful cross referenced html file.
Documentation is extracted for packages, classes, methods.
Lines matching
package <packageName> ;
are assumed to define packages.
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 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.
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
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 that can be set or retrieved by assignment
A reference to an array of Java source files that contain documentation as well as java
Name of the file to contain the generated documentation
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.
Indentation for methods vs classes and classes vs packages - defaults to 0
Background colours array expressed in html format - defaults to white
Methods available
Create a new java doc processor
Create documentation using html as the output format. Write the generated html to the file specified by target if any and return the generated html as an array of lines.
1 $javaDoc Java doc processor
1 colors
2 html
3 indent
4 new
5 source
6 target
7 wellKnownClasses
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
philiprbrenan@gmail.com
http://www.appaapps.com
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.
To install Java::Doc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Java::Doc
CPAN shell
perl -MCPAN -e shell install Java::Doc
For more information on module installation, please visit the detailed CPAN module installation guide.