Top Description Fields Constructors Methods
org.apache.tools.ant

public Class ProjectHelperRepository

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .InputStream, .InputStreamReader, java.lang.reflect.Constructor, java.net.URL, .URLConnection, java.nio.charset.StandardCharsets, java.util.ArrayList, .Collections, .Iterator, .List, java.util.stream.Stream, org.apache.tools.ant.helper.ProjectHelper2, org.apache.tools.ant.types.Resource, org.apache.tools.ant.util.LoaderUtils, .StreamUtils

Repository of ProjectHelper found in the classpath or via some System properties.

See the ProjectHelper documentation in the manual.

Since
Ant 1.8.0

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final String
private List<Constructor<? extends ProjectHelper>>
private static ProjectHelperRepository
private static Constructor<ProjectHelper2>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
private Constructor<? extends ProjectHelper>

Returns:

the constructor of the specified class.
getHelperConstructor
(String
The name of the class to create an instance of. Must not be null.
helperClass
)

Get the constructor with not argument of an helper from its class name.

public Iterator<ProjectHelper>

Returns:

an iterator of ProjectHelper
getHelpers
()

Get an iterator on the list of project helpers configured.

public static ProjectHelperRepository
private Constructor<? extends ProjectHelper>
private Constructor<? extends ProjectHelper>
public ProjectHelper

Returns:

the first ProjectHelper that fit the requirement (never null).
getProjectHelperForAntlib
(Resource
Resource
antlib
)

Get the helper that will be able to parse the specified antlib.

public ProjectHelper

Returns:

the first ProjectHelper that fit the requirement (never null).
getProjectHelperForBuildFile
(Resource
Resource
buildFile
)

Get the helper that will be able to parse the specified build file.

public void
registerProjectHelper(String
the fully qualified name of the helper
helperClassName
)

Register the specified project helper into the repository.

public void
registerProjectHelper(Class<? extends ProjectHelper>
the class of the helper
helperClass
)

Register the specified project helper into the repository.

private void
registerProjectHelper(Constructor<? extends ProjectHelper> helperConstructor)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
private static final boolean DEBUG
DEBUG_PROJECT_HELPER_REPOSITORYback to summary
private static final String DEBUG_PROJECT_HELPER_REPOSITORY
helpersback to summary
private List<Constructor<? extends ProjectHelper>> helpers
instanceback to summary
private static ProjectHelperRepository instance
PROJECTHELPER2_CONSTRUCTORback to summary
private static Constructor<ProjectHelper2> PROJECTHELPER2_CONSTRUCTOR

Constructor Detail

ProjectHelperRepositoryback to summary
private ProjectHelperRepository()

Method Detail

collectProjectHelpersback to summary
private void collectProjectHelpers()
getHelperConstructorback to summary
private Constructor<? extends ProjectHelper> getHelperConstructor(String helperClass) throws BuildException

Get the constructor with not argument of an helper from its class name. It'll first try the thread class loader, then Class.forName() will load from the same loader that loaded this class.

Parameters
helperClass:String

The name of the class to create an instance of. Must not be null.

Returns:Constructor<? extends ProjectHelper>

the constructor of the specified class.

Exceptions
BuildException:
if the class cannot be found or if a constructor with no argument cannot be found.
getHelpersback to summary
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:Iterator<ProjectHelper>

an iterator of ProjectHelper

getInstanceback to summary
public static ProjectHelperRepository getInstance()
getProjectHelperByServiceback to summary
private Constructor<? extends ProjectHelper> getProjectHelperByService(InputStream is)
getProjectHelperBySystemPropertyback to summary
private Constructor<? extends ProjectHelper> getProjectHelperBySystemProperty()
getProjectHelperForAntlibback to summary
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

Resource

Returns:ProjectHelper

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

getProjectHelperForBuildFileback to summary
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

Resource

Returns:ProjectHelper

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

registerProjectHelperback to summary
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:String

the fully qualified name of the helper

Exceptions
BuildException:
if the class cannot be loaded or if there is no constructor with no argument
Since
Ant 1.8.2
registerProjectHelperback to summary
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:Class<? extends ProjectHelper>

the class of the helper

Exceptions
BuildException:
if there is no constructor with no argument
Since
Ant 1.8.2
registerProjectHelperback to summary
private void registerProjectHelper(Constructor<? extends ProjectHelper> helperConstructor)