org.apache.tools.ant

Class 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
IteratorgetHelpers()
Get an iterator on the list of project helpers configured.
static ProjectHelperRepositorygetInstance()
ProjectHelpergetProjectHelperForAntlib(Resource antlib)
Get the helper that will be able to parse the specified antlib.
ProjectHelpergetProjectHelperForBuildFile(Resource buildFile)
Get the helper that will be able to parse the specified build file.
voidregisterProjectHelper(String helperClassName)
Register the specified project helper into the repository.
voidregisterProjectHelper(Class helperClass)
Register the specified project helper into the repository.

Method Detail

getHelpers

public Iterator 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

getInstance

public static ProjectHelperRepository getInstance()

getProjectHelperForAntlib

public ProjectHelper getProjectHelperForAntlib(Resource antlib)
Get the helper that will be able to parse the specified antlib. The helper will be chosen among the ones found in the classpath

Returns: the first ProjectHelper that fit the requirement (never null).

getProjectHelperForBuildFile

public ProjectHelper getProjectHelperForBuildFile(Resource buildFile)
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

Returns: the first ProjectHelper that fit the requirement (never null).

registerProjectHelper

public void registerProjectHelper(String helperClassName)
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 helperClass)
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