net.sf.fikin.ant
Class DocletTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sf.fikin.ant.DocletTask
Direct Known Subclasses:
VelocityDocletTask

public class DocletTask
extends org.apache.tools.ant.Task

Ant task tailored at running JavaDoc Doclets

Example: Execute MyDoclet against some java sources

      <doclet name="net.sf.fikin.ant.MyDoclet" >
          <packageset dir="src" defaultexcludes="yes">
              <include name="net/sf/fikin/ant/**" />
          </packageset>
      </doclet>
 

Example: Pass current timestamp as extra Java System parameters used by MyDoclet

      <doclet name="net.sf.fikin.ant.MyDoclet" >
          <packageset dir="src" defaultexcludes="yes">
              <include name="net/sf/fikin/ant/**" />
          </packageset>
          <param name="-J-DDSTAMP=${DSTAMP}" />
      </doclet>
 
created on Sep 24, 2006

Since:
Version:
$Revision: 1.7 $
Author:
fiykov
Ant Task Name:
doclet

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
DocletTask()
          instantiate a javadoc and embedded doclet objects
 
Method Summary
 void addFileset(org.apache.tools.ant.types.FileSet fs)
          Adds a fileset.
 void addPackage(org.apache.tools.ant.taskdefs.Javadoc.PackageName pn)
          Add a single package to be processed.
 void addPackageset(org.apache.tools.ant.types.DirSet packageSet)
          Adds a packageset.
protected  void addParam(java.lang.String name, java.lang.String value)
          an easy way to add a new Doclet parameter
protected  void check()
          consistency check on params
 org.apache.tools.ant.types.Path createBootclasspath()
          Create a Path to be configured with the boot classpath
 org.apache.tools.ant.types.Path createClasspath()
          Create a Path to be configured with the classpath to use
 org.apache.tools.ant.taskdefs.Javadoc.DocletParam createParam()
          Create a doclet parameter to be configured by Ant.
 org.apache.tools.ant.types.Path createSourcepath()
          Create a path to be configured with the locations of the source files.
 void execute()
          validate already set properties before continuing with javadoc generation
protected  void init_javadoc()
          init javadoc object prior to execution
 void setBootclasspath(org.apache.tools.ant.types.Path path)
          Set the boot classpath to use.
 void setBootClasspathRef(org.apache.tools.ant.types.Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setClasspath(org.apache.tools.ant.types.Path path)
           
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setExcludePackageNames(java.lang.String packages)
          Set the list of packages to be excluded.
 void setExecutable(java.lang.String executable)
          Sets the actual executable command to invoke, instead of the binary javadoc found in Ant's JDK.
 void setFailonerror(boolean b)
          Should the build process fail if javadoc fails (as indicated by a non zero return code)?
 void setLinksource(boolean b)
          Enables the -linksource switch, will be ignored if javadoc is not the 1.4 version.
 void setName(java.lang.String fqClassName)
          set doclet's fully-qualified class name
 void setPackageList(java.lang.String src)
          The name of a file containing the packages to process.
 void setPackagenames(java.lang.String packages)
          Set the package names to be processed.
 void setSource(java.lang.String source)
          Enables the -source switch, will be ignored if javadoc is not the 1.4 version.
 void setSourcepath(org.apache.tools.ant.types.Path src)
          Specify where to find source file
 void setSourcepathRef(org.apache.tools.ant.types.Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setVerbose(boolean b)
          Run javadoc in verbose mode
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocletTask

public DocletTask()
instantiate a javadoc and embedded doclet objects

Method Detail

setName

public void setName(java.lang.String fqClassName)
set doclet's fully-qualified class name

Parameters:
fqClassName - doclet's class name
Ant Task Param Required:
true

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path path)
Parameters:
path - doclet's classpath
Ant Task Param Required:
false

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

Parameters:
r - the reference to an instance defining the classpath.
Ant Task Param Required:
false

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Create a Path to be configured with the classpath to use

Returns:
a new Path instance to be configured with the classpath.
Ant Task Param Required:
false

setBootclasspath

public void setBootclasspath(org.apache.tools.ant.types.Path path)
Set the boot classpath to use.

Parameters:
path - the boot classpath.
Ant Task Param Required:
false

createBootclasspath

public org.apache.tools.ant.types.Path createBootclasspath()
Create a Path to be configured with the boot classpath

Returns:
a new Path instance to be configured with the boot classpath.
Ant Task Param Required:
false

setBootClasspathRef

public void setBootClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

Parameters:
r - the reference to an instance defining the bootclasspath.
Ant Task Param Required:
false

setSourcepath

public void setSourcepath(org.apache.tools.ant.types.Path src)
Specify where to find source file

Parameters:
src - a Path instance containing the various source directories.
Ant Task Param Required:
At least one of the three or nested <sourcepath>, <fileset> or <packageset>

createSourcepath

public org.apache.tools.ant.types.Path createSourcepath()
Create a path to be configured with the locations of the source files.

Returns:
a new Path instance to be configured by the Ant core.
Ant Task Param Required:
At least one of the three or nested <sourcepath>, <fileset> or <packageset>

setSourcepathRef

public void setSourcepathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

Parameters:
r - the reference containing the source path definition.
Ant Task Param Required:
At least one of the three or nested <sourcepath>, <fileset> or <packageset>

createParam

public org.apache.tools.ant.taskdefs.Javadoc.DocletParam createParam()
Create a doclet parameter to be configured by Ant.

Returns:
a new DocletParam instance to be configured.
Ant Task Param Required:
false

setFailonerror

public void setFailonerror(boolean b)
Should the build process fail if javadoc fails (as indicated by a non zero return code)?

Default is false.

Ant Task Param Required:
false

setSource

public void setSource(java.lang.String source)
Enables the -source switch, will be ignored if javadoc is not the 1.4 version.

Ant Task Param Required:
false

setVerbose

public void setVerbose(boolean b)
Run javadoc in verbose mode

Parameters:
b - true if operation is to be verbose.
Ant Task Param Required:
false

setExecutable

public void setExecutable(java.lang.String executable)
Sets the actual executable command to invoke, instead of the binary javadoc found in Ant's JDK.

Ant Task Param Required:
false

addPackageset

public void addPackageset(org.apache.tools.ant.types.DirSet packageSet)
Adds a packageset.

All included directories will be translated into package names be converting the directory separator into dots.

Ant Task Param Required:
false

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet fs)
Adds a fileset.

All included files will be added as sourcefiles. The task will automatically add includes="**/*.java" to the fileset.

Ant Task Param Required:
false

setLinksource

public void setLinksource(boolean b)
Enables the -linksource switch, will be ignored if javadoc is not the 1.4 version. Default is false

Ant Task Param Required:
false

setPackageList

public void setPackageList(java.lang.String src)
The name of a file containing the packages to process.

Parameters:
src - the file containing the package list.
Ant Task Param Required:
false

setPackagenames

public void setPackagenames(java.lang.String packages)
Set the package names to be processed.

Parameters:
packages - a comma separated list of packages specs (may be wildcarded).
See Also:
for wildcard information.
Ant Task Param Required:
false

addPackage

public void addPackage(org.apache.tools.ant.taskdefs.Javadoc.PackageName pn)
Add a single package to be processed. If the package name ends with ".*" the Javadoc task will find and process all subpackages.

Parameters:
pn - the package name, possibly wildcarded.
Ant Task Param Required:
false

setExcludePackageNames

public void setExcludePackageNames(java.lang.String packages)
Set the list of packages to be excluded.

Parameters:
packages - a comma separated list of packages to be excluded. This may not include wildcards.
Ant Task Param Required:
false

execute

public void execute()
             throws org.apache.tools.ant.BuildException
validate already set properties before continuing with javadoc generation

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

init_javadoc

protected void init_javadoc()
                     throws org.apache.tools.ant.BuildException
init javadoc object prior to execution

Throws:
org.apache.tools.ant.BuildException

check

protected void check()
              throws org.apache.tools.ant.BuildException
consistency check on params

Throws:
org.apache.tools.ant.BuildException

addParam

protected void addParam(java.lang.String name,
                        java.lang.String value)
an easy way to add a new Doclet parameter

Parameters:
name - parmaeter's name
value - parameter's value


Copyright © 2003-2007 Nikolay Fiykov. All Rights Reserved.