blob: c7e1153dbfb15c40f7cab72c7f2237f855910081 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Typedef Task</title>
</head>
<body>
<h2><a name="typedef">Typedef</a></h2>
<h3>Description</h3>
<p>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.</p>
<p>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:</p>
<pre>
typename=fully.qualified.java.classname
</pre>
<p>Typedef should be used to add your own types to the system. Data
types are things like <a href="../using.html#path">paths</a> or <a
href="../CoreTypes/fileset.html">filesets</a> that can be defined at
the project level and referenced via their ID attribute.</p>
<p>Custom data types usually need custom tasks to put them to good use.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">name</td>
<td valign="top">the name of the data type</td>
<td valign="top" align="center">Yes, unless file or resource have
been specified.</td>
</tr>
<tr>
<td valign="top">classname</td>
<td valign="top">the full class name implementing the data type</td>
<td valign="top" align="center">Yes, unless file or resource have
been specified.</td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">Name of the property file to load
typename/classname pairs from.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">resource</td>
<td valign="top">Name of the property resource to load
typename/classname pairs from.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">classpath</td> <td valign="top">the classpath to
use when looking up <code>classname</code>.</td> <td
align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">loaderRef</td> <td valign="top">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 )</td>
<td align="center" valign="top">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>classpath</h4>
<p><code>Typedef</code>'s <i>classpath</i> attribute is a
<a href="../using.html#path">PATH like structure</a> and can also be set
via a nested <i>classpath</i> element.</p>
<h3>Examples</h3>
<pre> &lt;typedef name=&quot;urlset&quot; classname=&quot;com.mydomain.URLSet&quot;/&gt;</pre>
<p>makes a data type called <code>urlset</code> available to Ant. The
class <code>com.mydomain.URLSet</code> implements this type.</p>
<hr>
<p align="center">Copyright &copy; 2001-2002 Apache Software
Foundation. All rights Reserved.</p>
</body>
</html>