## org.apache.tools.ant.taskdefs
Class Definer

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.Definer

Direct Known Subclasses:
  Taskdef, Typedef

public abstract class Definer
extends Task

Base class for Taskdef and Typedef - does all the classpath handling and and class loading.

Since:
  Ant 1.4
Author:
  Costin Manolache, Stefan Bodewig

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`Definer()`

Method Summary
`protected abstract void` `addDefinition(java.lang.String name, java.lang.Class c)` this must be implemented by subclasses; it is the callback they will get to add a new definition of their type
`Path` `createClasspath()` Create the classpath to be used when searching for component being defined
`void` `execute()` Called by the project to let the task do its work.
`java.lang.String` `getClassname()` what is the classname we are definining? Can be null
`void` `setClassname(java.lang.String v)` the full class name of the object being defined.
`void` `setClasspath(Path classpath)` Set the classpath to be used when searching for component being defined
`void` `setClasspathRef(Reference r)` reference to a classpath to use when loading the files.
`void` `setFile(java.io.File file)` Name of the property file to load ant name/classname pairs from.
`void` `setLoaderRef(Reference r)` Use the reference to locate the loader.
`void` `setName(java.lang.String name)` Name of the property resource to load ant name/classname pairs from.
`void` `setResource(java.lang.String res)` Name of the property resource to load ant name/classname pairs from.
`void` `setReverseLoader(boolean reverseLoader)` Deprecated. stop using this attribute

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Definer

    public Definer()

Method Detail

### setReverseLoader

    public void setReverseLoader(boolean reverseLoader)

  Deprecated. stop using this attribute

### setClasspath

    public void setClasspath(Path classpath)

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

  Parameters:
    `classpath` - an Ant Path object containing the classpath.

### createClasspath

    public Path createClasspath()

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

### setClasspathRef

    public void setClasspathRef(Reference r)

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

### setLoaderRef

    public void setLoaderRef(Reference r)

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

  Since:
    Ant 1.5

### execute

    public void execute()
                 throws BuildException

  Description copied from class: `Task`
  Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.

  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### setFile

    public void setFile(java.io.File file)

  Name of the property file to load ant name/classname pairs from.

### setResource

    public void setResource(java.lang.String res)

  Name of the property resource to load ant name/classname pairs from.

### setName

    public void setName(java.lang.String name)

  Name of the property resource to load ant name/classname pairs from.

### getClassname

    public java.lang.String getClassname()

  what is the classname we are definining? Can be null

### setClassname

    public void setClassname(java.lang.String v)

  the full class name of the object being defined. Required, unless file or resource have been specified.

### addDefinition

    protected abstract void addDefinition(java.lang.String name,
                                          java.lang.Class c)

  this must be implemented by subclasses; it is the callback they will get to add a new definition of their type

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.