Typedef

Description

Adds a data type definition to the current project, such that this new type can be used in the current project. Two attributes are needed, the name that identifies this data type uniquely, and the full name of the class (including the packages) that implements this type.

You can also define a group of data types at once using the file or resource attributes. These attributes point to files in the format of Java property files. Each line defines a single data type in the format:


typename=fully.qualified.java.classname

Typedef should be used to add your own types to the system. Data types are things like paths or filesets that can be defined at the project level and referenced via their ID attribute.

Custom data types usually need custom tasks to put them to good use.

Parameters

Attribute Description Required
name the name of the data type Yes, unless file or resource have been specified.
classname the full class name implementing the data type Yes, unless file or resource have been specified.
file Name of the property file to load typename/classname pairs from. No
resource Name of the property resource to load typename/classname pairs from. No
classpath the classpath to use when looking up classname. No
loaderRef the name of the loader that is used to load the class, constructed from the specified classpath. Use this to allow multiple tasks/types to be loaded with the same loader, so they can call each other. ( introduced in ant1.5 ) No

Parameters specified as nested elements

classpath

Typedef's classpath attribute is a PATH like structure and can also be set via a nested classpath element.

Examples

  <typedef name="urlset" classname="com.mydomain.URLSet"/>

makes a data type called urlset available to Ant. The class com.mydomain.URLSet implements this type.


Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.