Top Description Methods
org.apache.tools.ant.util.depend

public Interface DependencyAnalyzer

Known Direct Implementers
org.apache.tools.ant.util.depend.AbstractAnalyzer
Imports
java.io.File, .IOException, java.util.Enumeration, org.apache.tools.ant.types.Path

A dependency analyzer analyzes dependencies between Java classes to determine the minimal set of classes which are required by a set of "root" classes. Different implementations of this interface can use different strategies and libraries to determine the required set. For example, some analyzers will use class files while others might use source files. Analyzer specific configuration is catered for through a generic configure method

Method Summary

Modifier and TypeMethod and Description
public void
addClassPath(Path
the Path instance specifying the classpath elements
classpath
)

Add a classpath to the classpath being used by the analyzer.

public void
addRootClass(String
the name of the class in Java dot notation.
classname
)

Add a root class.

public void
addSourcePath(Path
The Path instance specifying the source path elements.
sourcePath
)

Add a source path to the source path used by this analyzer.

public void
config(String
the name of the aspect being configured
name
,
Object
the configuration information.
info
)

Configure an aspect of the analyzer.

public File

Returns:

the file instance, zip or class, containing the class or null if the class could not be found.
getClassContainer
(String
the name of the required class
classname
)

Get the file that contains the class definition

public Enumeration<String>

Returns:

an enumeration of Strings, each being the name of a Java class in dot notation.
getClassDependencies
()

Get the list of classes upon which root classes depend.

public Enumeration<File>

Returns:

an enumeration of File instances.
getFileDependencies
()

Get the list of files in the file system upon which the root classes depend.

public File

Returns:

the file instance, zip or java, containing the source or null if the source for the class could not be found.
getSourceContainer
(String
the name of the required class
classname
)

Get the file that contains the class source.

public void
reset()

Reset the dependency list.

public void
setClosure(boolean
true if dependencies should be traversed to determine indirect dependencies.
closure
)

Set the closure flag.

Method Detail

addClassPathback to summary
public void addClassPath(Path classpath)

Add a classpath to the classpath being used by the analyzer. The classpath contains the binary classfiles for the classes being analyzed The elements may either be the directories or jar files.Not all analyzers will use this information.

Parameters
classpath:Path

the Path instance specifying the classpath elements

addRootClassback to summary
public void addRootClass(String classname)

Add a root class. The root classes are used to drive the determination of dependency information. The analyzer will start at the root classes and add dependencies from there.

Parameters
classname:String

the name of the class in Java dot notation.

addSourcePathback to summary
public void addSourcePath(Path sourcePath)

Add a source path to the source path used by this analyzer. The elements in the given path contain the source files for the classes being analyzed. Not all analyzers will use this information.

Parameters
sourcePath:Path

The Path instance specifying the source path elements.

configback to summary
public void config(String name, Object info)

Configure an aspect of the analyzer. The set of aspects that are supported is specific to each analyzer instance.

Parameters
name:String

the name of the aspect being configured

info:Object

the configuration information.

getClassContainerback to summary
public File getClassContainer(String classname) throws IOException

Get the file that contains the class definition

Parameters
classname:String

the name of the required class

Returns:File

the file instance, zip or class, containing the class or null if the class could not be found.

Exceptions
IOException:
if the files in the classpath cannot be read.
getClassDependenciesback to summary
public Enumeration<String> getClassDependencies()

Get the list of classes upon which root classes depend. This is a list of Java classnames in dot notation.

Returns:Enumeration<String>

an enumeration of Strings, each being the name of a Java class in dot notation.

getFileDependenciesback to summary
public Enumeration<File> getFileDependencies()

Get the list of files in the file system upon which the root classes depend. The files will be either the classfiles or jar files upon which the root classes depend.

Returns:Enumeration<File>

an enumeration of File instances.

getSourceContainerback to summary
public File getSourceContainer(String classname) throws IOException

Get the file that contains the class source.

Parameters
classname:String

the name of the required class

Returns:File

the file instance, zip or java, containing the source or null if the source for the class could not be found.

Exceptions
IOException:
if the files in the sourcepath cannot be read.
resetback to summary
public void reset()

Reset the dependency list. This will reset the determined dependencies and the also list of root classes.

setClosureback to summary
public void setClosure(boolean closure)

Set the closure flag. If this flag is true the analyzer will traverse all class relationships until it has collected the entire set of direct and indirect dependencies

Parameters
closure:boolean

true if dependencies should be traversed to determine indirect dependencies.