Package org.apache.tools.ant.util.depend

# Interface DependencyAnalyzer

All Known Implementing Classes:
  `AbstractAnalyzer`, `AncestorAnalyzer`, `AntAnalyzer`, `FullAnalyzer`

    public interface DependencyAnalyzer

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 Type | Method | Description
  --- | --- | ---
  `void` | `addClassPath​(Path classpath)` | Add a classpath to the classpath being used by the analyzer.
  `void` | `addRootClass​(java.lang.String classname)` | Add a root class.
  `void` | `addSourcePath​(Path sourcePath)` | Add a source path to the source path used by this analyzer.
  `void` | `config​(java.lang.String name, java.lang.Object info)` | Configure an aspect of the analyzer.
  `java.io.File` | `getClassContainer​(java.lang.String classname)` | Get the file that contains the class definition
  `java.util.Enumeration<java.lang.String>` | `getClassDependencies()` | Get the list of classes upon which root classes depend.
  `java.util.Enumeration<java.io.File>` | `getFileDependencies()` | Get the list of files in the file system upon which the root classes depend.
  `java.io.File` | `getSourceContainer​(java.lang.String classname)` | Get the file that contains the class source.
  `void` | `reset()` | Reset the dependency list.
  `void` | `setClosure​(boolean closure)` | Set the closure flag.

- ## Method Details

  - ### addSourcePath

    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` - The Path instance specifying the source path elements.

  - ### addClassPath

    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` - the Path instance specifying the classpath elements

  - ### addRootClass

    void addRootClass​(java.lang.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` - the name of the class in Java dot notation.

  - ### getFileDependencies

    java.util.Enumeration<java.io.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:
      an enumeration of File instances.

  - ### getClassDependencies

    java.util.Enumeration<java.lang.String> getClassDependencies()
    Get the list of classes upon which root classes depend. This is a list of Java classnames in dot notation.
    Returns:
      an enumeration of Strings, each being the name of a Java class in dot notation.

  - ### reset

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

  - ### config

    void config​(java.lang.String name, java.lang.Object info)
    Configure an aspect of the analyzer. The set of aspects that are supported is specific to each analyzer instance.
    Parameters:
      `name` - the name of the aspect being configured
      `info` - the configuration information.

  - ### setClosure

    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` - true if dependencies should be traversed to determine indirect dependencies.

  - ### getClassContainer

    java.io.File getClassContainer​(java.lang.String classname) throws java.io.IOException
    Get the file that contains the class definition
    Parameters:
      `classname` - the name of the required class
    Returns:
      the file instance, zip or class, containing the class or null if the class could not be found.
    Throws:
      `java.io.IOException` - if the files in the classpath cannot be read.

  - ### getSourceContainer

    java.io.File getSourceContainer​(java.lang.String classname) throws java.io.IOException
    Get the file that contains the class source.
    Parameters:
      `classname` - the name of the required class
    Returns:
      the file instance, zip or java, containing the source or null if the source for the class could not be found.
    Throws:
      `java.io.IOException` - if the files in the sourcepath cannot be read.