FileDocCategorySizeDatePackage
DefBase.javaAPI DocApache Ant 1.705284Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs

DefBase

public abstract class DefBase extends AntlibDefinition
Base class for Definitions handling uri and class loading. (This was part of Definer)
since
Ant 1.6

Fields Summary
private ClassLoader
createdLoader
private ClasspathUtils.Delegate
cpDelegate
Constructors Summary
Methods Summary
public org.apache.tools.ant.types.PathcreateClasspath()
Create the classpath to be used when searching for component being defined.

return
the classpath of the this definition

        return getDelegate().createClasspath();
    
protected java.lang.ClassLoadercreateLoader()
create a classloader for this definition

return
the classloader from the cpDelegate

        if (getAntlibClassLoader() != null && cpDelegate == null) {
            return getAntlibClassLoader();
        }
        if (createdLoader == null) {
            createdLoader = getDelegate().getClassLoader();
            // need to load Task via system classloader or the new
            // task we want to define will never be a Task but always
            // be wrapped into a TaskAdapter.
            ((AntClassLoader) createdLoader)
                .addSystemPackageRoot("org.apache.tools.ant");
        }
        return createdLoader;
    
public org.apache.tools.ant.types.PathgetClasspath()

return
the classpath for this definition

        return getDelegate().getClasspath();
    
public java.lang.StringgetClasspathId()
Returns the class path id of the class path delegate.

return
the class path id

        return getDelegate().getClassLoadId();
    
private ClasspathUtils.DelegategetDelegate()

        if (cpDelegate == null) {
            cpDelegate = ClasspathUtils.getDelegate(this);
        }
        return cpDelegate;
    
public java.lang.StringgetLoaderId()
Returns the loader id of the class path Delegate.

return
the loader id

        return getDelegate().getClassLoadId();
    
protected booleanhasCpDelegate()
Check if classpath attributes have been set. (to be called before getCpDelegate() is used.

return
true if cpDelegate has been created.

        return cpDelegate != null;
    
public voidinit()

see
org.apache.tools.ant.Task#init()
throws
BuildException on error.
since
Ant 1.6

        super.init();
    
public booleanisReverseLoader()

return
the reverse loader attribute of the classpath delegate.

        return getDelegate().isReverseLoader();
    
public voidsetClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath to be used when searching for component being defined.

param
classpath an Ant Path object containing the classpath.

        getDelegate().setClasspath(classpath);
    
public voidsetClasspathRef(org.apache.tools.ant.types.Reference r)
Set a reference to a classpath to use when loading the files. To actually share the same loader, set loaderref as well

param
r the reference to the classpath

        getDelegate().setClasspathref(r);
    
public voidsetLoaderRef(org.apache.tools.ant.types.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.

param
r the reference to locate the loader.
since
Ant 1.5

        getDelegate().setLoaderRef(r);
    
public voidsetReverseLoader(boolean reverseLoader)

param
reverseLoader if true a delegated loader will take precedence over the parent
deprecated
since 1.6.x. stop using this attribute
ant.attribute
ignore="true"

        getDelegate().setReverseLoader(reverseLoader);
        log("The reverseloader attribute is DEPRECATED. It will be removed",
            Project.MSG_WARN);