ProjectHelperRepository (Apache Ant API)
Description: declaration: package: org.apache.tools.ant, class: ProjectHelperRepository

# Class ProjectHelperRepository

java.lang.Object
org.apache.tools.ant.ProjectHelperRepository

public class ProjectHelperRepository extends Object
Repository of `ProjectHelper` found in the classpath or via some System properties.

See the ProjectHelper documentation in the manual.

Since:
  Ant 1.8.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterator<ProjectHelper>`
  `getHelpers()`
  Get an iterator on the list of project helpers configured.
  `static ProjectHelperRepository`
  `getInstance()`
  `ProjectHelper`
  `getProjectHelperForAntlib(Resource antlib)`
  Get the helper that will be able to parse the specified antlib.
  `ProjectHelper`
  `getProjectHelperForBuildFile(Resource buildFile)`
  Get the helper that will be able to parse the specified build file.
  `void`
  `registerProjectHelper(Class<? extends ProjectHelper> helperClass)`
  Register the specified project helper into the repository.
  `void`
  `registerProjectHelper(String helperClassName)`
  Register the specified project helper into the repository.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    public static ProjectHelperRepository getInstance()

  - ### registerProjectHelper

    public void registerProjectHelper(String helperClassName) throws BuildException
    Register the specified project helper into the repository.

    The helper will be added after all the already registered helpers, but before the default one (ProjectHelper2)

    Parameters:
      `helperClassName` - the fully qualified name of the helper
    Throws:
      `BuildException` - if the class cannot be loaded or if there is no constructor with no argument
    Since:
      Ant 1.8.2

  - ### registerProjectHelper

    public void registerProjectHelper(Class<? extends ProjectHelper> helperClass) throws BuildException
    Register the specified project helper into the repository.

    The helper will be added after all the already registered helpers, but before the default one (ProjectHelper2)

    Parameters:
      `helperClass` - the class of the helper
    Throws:
      `BuildException` - if there is no constructor with no argument
    Since:
      Ant 1.8.2

  - ### getProjectHelperForBuildFile

    public ProjectHelper getProjectHelperForBuildFile(Resource buildFile) throws BuildException
    Get the helper that will be able to parse the specified build file. The helper will be chosen among the ones found in the classpath
    Parameters:
      `buildFile` - Resource
    Returns:
      the first ProjectHelper that fit the requirement (never `null`).
    Throws:
      `BuildException`

  - ### getProjectHelperForAntlib

    public ProjectHelper getProjectHelperForAntlib(Resource antlib) throws BuildException
    Get the helper that will be able to parse the specified antlib. The helper will be chosen among the ones found in the classpath
    Parameters:
      `antlib` - Resource
    Returns:
      the first ProjectHelper that fit the requirement (never `null`).
    Throws:
      `BuildException`

  - ### getHelpers

    public Iterator<ProjectHelper> getHelpers()
    Get an iterator on the list of project helpers configured. The iterator will always return at least one element as there will always be the default project helper configured.
    Returns:
      an iterator of `ProjectHelper`