mjc

org.multijava.mjdoc.mjdoc_142
Class MjdocWrapper

java.lang.Object
  extended byorg.multijava.mjdoc.mjdoc_142.MjdocWrapper

public class MjdocWrapper
extends Object

This class is a bridge between the Mjc parsing mechanisms in Main and the html generation mechanisms in MjRootDoc and related classes.

Author:
David R. Cok

Nested Class Summary
static class MjdocWrapper.CClassMap
           
static class MjdocWrapper.MjPrivacyChecker
           
static interface MjdocWrapper.PrivacyChecker
           
 
Field Summary
private static String appName
           
private static String classpath
          The classpath specified by the -classpath option
protected  Compiler compiler
           
private static File destination
          The destination specified by the -d option.
(package private) static boolean doallfcns
          If true, then create generic function html pages for internal as well as external functions.
private static String docletname
          The name of a doclet, as specified in the options.
private static String docletpath
          The path in which to search for the doclet, if specified in the options.
(package private) static boolean docupages
          If true, then generate pages for the external method part of each compilation unit.
(package private) static boolean donofcns
          If true, then generate no html pages for any generic functions.
protected static Map map
          Map of CClass to MjClassDoc for all classes encountered in parsing.
protected static MjdocWrapper.CClassMap mapper
           
private static long privacy
          The privacy level controlling the items listed in the html: 0 - public only, 1 - public and protected, 2 - all but private, 3 - everything.
static MjdocWrapper.PrivacyChecker privacyChecker
           
private static MjRootDoc root
          Holds the RootDoc value that is the root of the tree representing all the classes being documented.
private static String sourcepath
          The sourcepath specified by the -sourcepath option
protected static MjdocWrapper wrapper
           
 
Constructor Summary
MjdocWrapper(Compiler c)
           
 
Method Summary
static String appName()
           
static boolean checkPrivacy(long mods)
          Returns true if the given modifiers combined with the privacy level set in the options are such as to have the program element listed in the html.
static boolean complete()
          This initiates the generation of html, given the tree of information loaded into the javadoc classes.
private static File findFile(String dirlist, String filename)
          Searches for the given file in some component of the given pathlist, returning a corresponding File object if found or null if not found.
private static String[] formArray(String[] args, int i, int n)
          This is a helper method that creates a String[] of length n containing the elements args[i] .. args[i+n-1].
protected  void handleQuiet(MjcCommonOptions options)
          Handle Jmldoc's Quiet option
static MjClassDoc lookup(CClass cclass)
          Returns the MjClassDoc object generated from the given CClass; if the CClass object was not previously registered, an MjClassDoc object is created.
private static int optionLength(String s)
          This function returns the number of arguments that follow a given option (+1 for the option itself) in the command-line.
private  void parseArguments(String[] args, MjcCommonOptions options, ArrayList remainingArgs)
          Parse the Javadoc options into the options structure
private  void parseOptions(MjcCommonOptions options, ArrayList opt)
          Loads the javadoc options from the Options AST into an array so they can be passed to javadoc
static long privacy()
           
static void quiet(boolean b)
          Turns off all informational messages.
static String readFile(File f)
          Reads a text file into a String.
 void register(CompilerPassEnterable tree)
          Loads all the classes and interfaces contained in 'tree' into the RootDoc.
static void register(CType ct)
          Makes sure that the given type is registered as a referenced class, if appropriate.
 void register(JCompilationUnitType unit)
          Loads all the classes and interfaces contained in 'tree' into the RootDoc.
(package private)  void register(JTypeDeclarationType jtype)
          Registers a specific class or interface (and any classes or interfaces nested or referenced within it) into the RootDoc.
 void registerGFs(ArrayList tlmethods, MjExtMethodsDoc mje)
           
 void registerTypeDeclarations(JCompilationUnitType unit)
           
 void registerTypeDeclarations(JTypeDeclarationType[] jtypes, JCompilationUnitType unit)
           
static MjRootDoc root()
           
 void select(JTypeDeclarationType jtype)
           
 void selected(CompilerPassEnterable tree)
          Loads all the classes and interfaces contained in 'trees' as command-line specified classes, for which javadoc documents will be generated.
 void selected(JTypeDeclarationType jtype)
          Loads all the given class as command-line specified classes, for which documents will be generated.
 void selected(JTypeDeclarationType[] jtypes, JCompilationUnitType unit)
           
static void selectPackages(ArrayList v)
          This function creates and specifies the list of packages in the given ArrayList; the ArrayList consists of String objects, each of which is a '/'-separated and '/'-terminated package name.
 void selectTypeDeclarations(JCompilationUnitType unit)
           
static void setAppName(String n)
           
(package private) static void setDocComment(MjDoc doc, File f)
          Sets the javadoc comment in the given Doc using the content (between and ) of the given file.
(package private) static void setDocComment(MjDoc doc, MjcCommonOptions opts, String pathlist)
          Sets the overview doc comment using the overview option in 'opts' .
static void setDoclet(String n)
          Sets the doclet to run
 String[] setOptions(String[] args, MjcCommonOptions options)
          This routine parses the command-line options provided in 'args', recognizing any javadoc-related options and their arguments.
static void setWrapper(MjdocWrapper w)
           
static MjdocWrapper wrapper()
          Allows subclasses to change the wrapper behavior.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compiler

protected Compiler compiler

root

private static MjRootDoc root
Holds the RootDoc value that is the root of the tree representing all the classes being documented.


wrapper

protected static MjdocWrapper wrapper

doallfcns

static boolean doallfcns
If true, then create generic function html pages for internal as well as external functions. If doallfcns = false and donofcns = false, then only external function pages are generated.


donofcns

static boolean donofcns
If true, then generate no html pages for any generic functions.


docupages

static boolean docupages
If true, then generate pages for the external method part of each compilation unit.


docletname

private static String docletname
The name of a doclet, as specified in the options.


docletpath

private static String docletpath
The path in which to search for the doclet, if specified in the options.


classpath

private static String classpath
The classpath specified by the -classpath option


sourcepath

private static String sourcepath
The sourcepath specified by the -sourcepath option


destination

private static File destination
The destination specified by the -d option.


privacy

private static long privacy
The privacy level controlling the items listed in the html: 0 - public only, 1 - public and protected, 2 - all but private, 3 - everything.


privacyChecker

public static MjdocWrapper.PrivacyChecker privacyChecker

appName

private static String appName

map

protected static Map map
Map of CClass to MjClassDoc for all classes encountered in parsing. Note: from a JTypeDeclarationType, one can get a CClass using getCClass().


mapper

protected static MjdocWrapper.CClassMap mapper
Constructor Detail

MjdocWrapper

public MjdocWrapper(Compiler c)
Method Detail

root

public static MjRootDoc root()

wrapper

public static MjdocWrapper wrapper()
Allows subclasses to change the wrapper behavior.


setWrapper

public static void setWrapper(MjdocWrapper w)

privacy

public static long privacy()

checkPrivacy

public static boolean checkPrivacy(long mods)
Returns true if the given modifiers combined with the privacy level set in the options are such as to have the program element listed in the html.


setDoclet

public static void setDoclet(String n)
Sets the doclet to run


quiet

public static void quiet(boolean b)
Turns off all informational messages.


appName

public static String appName()

setAppName

public static void setAppName(String n)

lookup

public static MjClassDoc lookup(CClass cclass)
Returns the MjClassDoc object generated from the given CClass; if the CClass object was not previously registered, an MjClassDoc object is created.


selectPackages

public static void selectPackages(ArrayList v)
This function creates and specifies the list of packages in the given ArrayList; the ArrayList consists of String objects, each of which is a '/'-separated and '/'-terminated package name.


selected

public void selected(CompilerPassEnterable tree)
              throws Exception
Loads all the classes and interfaces contained in 'trees' as command-line specified classes, for which javadoc documents will be generated.

Throws:
Exception

selectTypeDeclarations

public void selectTypeDeclarations(JCompilationUnitType unit)

selected

public void selected(JTypeDeclarationType[] jtypes,
                     JCompilationUnitType unit)

selected

public void selected(JTypeDeclarationType jtype)
              throws Exception
Loads all the given class as command-line specified classes, for which documents will be generated.

Throws:
Exception

select

public void select(JTypeDeclarationType jtype)

register

public void register(CompilerPassEnterable tree)
              throws Exception
Loads all the classes and interfaces contained in 'tree' into the RootDoc.

Throws:
Exception

register

public void register(JCompilationUnitType unit)
              throws Exception
Loads all the classes and interfaces contained in 'tree' into the RootDoc.

Throws:
Exception

registerTypeDeclarations

public void registerTypeDeclarations(JCompilationUnitType unit)

registerTypeDeclarations

public void registerTypeDeclarations(JTypeDeclarationType[] jtypes,
                                     JCompilationUnitType unit)

registerGFs

public void registerGFs(ArrayList tlmethods,
                        MjExtMethodsDoc mje)

register

void register(JTypeDeclarationType jtype)
        throws Exception
Registers a specific class or interface (and any classes or interfaces nested or referenced within it) into the RootDoc.

Parameters:
jtype - A specific class or interface to register as referenced
Throws:
Exception

register

public static void register(CType ct)
Makes sure that the given type is registered as a referenced class, if appropriate.


complete

public static boolean complete()
This initiates the generation of html, given the tree of information loaded into the javadoc classes.

Returns:
true if the html generation was successful

formArray

private static String[] formArray(String[] args,
                                  int i,
                                  int n)
This is a helper method that creates a String[] of length n containing the elements args[i] .. args[i+n-1].


optionLength

private static int optionLength(String s)
This function returns the number of arguments that follow a given option (+1 for the option itself) in the command-line.


setOptions

public String[] setOptions(String[] args,
                           MjcCommonOptions options)
This routine parses the command-line options provided in 'args', recognizing any javadoc-related options and their arguments. A new String array is returned that contains only the arguments in 'args' that were not recognized. The recognized options are loaded into the RootDoc to be used in the html generation.


parseArguments

private void parseArguments(String[] args,
                            MjcCommonOptions options,
                            ArrayList remainingArgs)
Parse the Javadoc options into the options structure


parseOptions

private void parseOptions(MjcCommonOptions options,
                          ArrayList opt)
Loads the javadoc options from the Options AST into an array so they can be passed to javadoc


handleQuiet

protected void handleQuiet(MjcCommonOptions options)
Handle Jmldoc's Quiet option


readFile

public static String readFile(File f)
                       throws Exception
Reads a text file into a String.

Throws:
Exception

setDocComment

static void setDocComment(MjDoc doc,
                          MjcCommonOptions opts,
                          String pathlist)
Sets the overview doc comment using the overview option in 'opts' .


findFile

private static File findFile(String dirlist,
                             String filename)
Searches for the given file in some component of the given pathlist, returning a corresponding File object if found or null if not found.


setDocComment

static void setDocComment(MjDoc doc,
                          File f)
Sets the javadoc comment in the given Doc using the content (between and ) of the given file.


mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.