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

public abstract Class DefBase

extends AntlibDefinition
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.Definer, org.apache.tools.ant.taskdefs.Input.Handler, org.apache.tools.ant.taskdefs.optional.script.ScriptDef
Imports
org.apache.tools.ant.AntClassLoader, .BuildException, .MagicNames, .Project, org.apache.tools.ant.types.Path, .Reference, org.apache.tools.ant.util.ClasspathUtils

Base class for Definitions handling uri and class loading. (This was part of Definer)
Since
Ant 1.6

Field Summary

Modifier and TypeField and Description
private ClasspathUtils.Delegate
private ClassLoader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Path

Returns:

the classpath of the this definition
createClasspath
()

Create the classpath to be used when searching for component being defined.

protected ClassLoader

Returns:

the classloader from the cpDelegate
createLoader
()

create a classloader for this definition

public Path

Returns:

the classpath for this definition
getClasspath
()

public String

Returns:

the class path id
getClasspathId
()

Returns the class path id of the class path delegate.

private ClasspathUtils.Delegate
public String

Returns:

the loader id
getLoaderId
()

Returns the loader id of the class path Delegate.

protected boolean

Returns:

true if cpDelegate has been created.
hasCpDelegate
()

Check if classpath attributes have been set.

public void
init()

Overrides org.apache.tools.ant.Task.init.

Called by the project to let the task initialize properly.
public boolean

Returns:

the reverse loader attribute of the classpath delegate.
isReverseLoader
()

public void
setClasspath(Path
an Ant Path object containing the classpath.
classpath
)

Set the classpath to be used when searching for component being defined.

public void
setClasspathRef(Reference
the reference to the classpath
r
)

Set a reference to a classpath to use when loading the files.

public void
setLoaderRef(Reference
the reference to locate the loader.
r
)

Use the reference to locate the loader.

public void
setReverseLoader(boolean
if true a delegated loader will take precedence over the parent
reverseLoader
)

Deprecated since 1.6.x. stop using this attribute
Inherited from org.apache.tools.ant.taskdefs.AntlibDefinition:
getAntlibClassLoadergetURIsetAntlibClassLoadersetURI

Field Detail

cpDelegateback to summary
private ClasspathUtils.Delegate cpDelegate
createdLoaderback to summary
private ClassLoader createdLoader

Constructor Detail

DefBaseback to summary
public DefBase()

Method Detail

createClasspathback to summary
public Path createClasspath()

Create the classpath to be used when searching for component being defined.

Returns:Path

the classpath of the this definition

createLoaderback to summary
protected ClassLoader createLoader()

create a classloader for this definition

Returns:ClassLoader

the classloader from the cpDelegate

getClasspathback to summary
public Path getClasspath()
Returns:Path

the classpath for this definition

getClasspathIdback to summary
public String getClasspathId()

Returns the class path id of the class path delegate.

Returns:String

the class path id

getDelegateback to summary
private ClasspathUtils.Delegate getDelegate()
getLoaderIdback to summary
public String getLoaderId()

Returns the loader id of the class path Delegate.

Returns:String

the loader id

hasCpDelegateback to summary
protected boolean hasCpDelegate()

Check if classpath attributes have been set. (to be called before getCpDelegate() is used.

Returns:boolean

true if cpDelegate has been created.

initback to summary
public void init() throws BuildException

Overrides org.apache.tools.ant.Task.init.

Doc from org.apache.tools.ant.Task.init.

Called by the project to let the task initialize properly. The default implementation is a no-op.

Exceptions
BuildException:
on error.
Since
Ant 1.6
See Also
org.apache.tools.ant.Task#init()
isReverseLoaderback to summary
public boolean isReverseLoader()
Returns:boolean

the reverse loader attribute of the classpath delegate.

setClasspathback to summary
public void setClasspath(Path classpath)

Set the classpath to be used when searching for component being defined.

Parameters
classpath:Path

an Ant Path object containing the classpath.

setClasspathRefback to summary
public void setClasspathRef(Reference r)

Set a reference to a classpath to use when loading the files. To actually share the same loader, set loaderref as well

Parameters
r:Reference

the reference to the classpath

setLoaderRefback to summary
public void setLoaderRef(Reference r)

Use the reference to locate the loader. If the loader is not found, the specified classpath will be used and registered with the specified name. This allows multiple taskdef/typedef to use the same class loader, so they can be used together, eliminating the need to put them in the CLASSPATH.

Parameters
r:Reference

the reference to locate the loader.

Since
Ant 1.5
setReverseLoaderback to summary
public void setReverseLoader(boolean reverseLoader)

Deprecated

since 1.6.x. stop using this attribute

Parameters
reverseLoader:boolean

if true a delegated loader will take precedence over the parent

Annotations
@Deprecated