The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Java::Doc - Extract documentation from Java source code.

Synopsis

  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.

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.

indent :lvalue

Indentation for methods vs classes and classes vs packages - defaults to 0

colors :lvalue

Background colours array expressed in html format - defaults to white

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 return the generated html as an array of lines.

  1  $javaDoc  Java doc processor

Index

1 colors

2 html

3 indent

4 new

5 source

6 target

7 wellKnownClasses

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

philiprbrenan@gmail.com

http://www.appaapps.com

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.