ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shyam Koppikar" <vkopp...@tds.net>
Subject Re: Are all nexted elements implemented as DataType extensions?
Date Fri, 28 Sep 2001 03:24:34 GMT

----- Original Message -----
From: "Conor MacNeill" <conor@cortexebusiness.com.au>
To: <ant-user@jakarta.apache.org>
Sent: Wednesday, September 26, 2001 7:46 PM
Subject: RE: Are all nexted elements implemented as DataType extensions?


> Angus,
>
> You do not need to use typdef to support nested elements. There are many
> examples in Ant itself of classes which support nested elements which are
> not typedef'd. Have a look at the javadoc task's code. It supports a
<link>
> nested element by having a nested class which stores the link information
>
>     public class LinkArgument {
>         private String href;
>         private boolean offline = false;
>         private File packagelistLoc;
>
>         public LinkArgument() {
>         }
>
>         public void setHref(String hr) {
>             href = hr;
>         }
>
> and then supports that element via this method
>     public LinkArgument createLink() {
>         LinkArgument la = new LinkArgument();
>         links.addElement(la);
>         return la;
>     }
>
> There is no need to typedef this type. It is just private to the task
being
> used.
>
> Conor
>
>
> > -----Original Message-----
> > From: McCollum , Angus [mailto:AMcCollum@grow.net]
> > Sent: Thursday, 27 September 2001 8:00 AM
> > To: 'ant-user@jakarta.apache.org'
> > Subject: RE: Are all nexted elements implemented as DataType extensions?
> >
> >
> > Thank you Erik. Both of those are great examples of nesting tasks.
> >
> > I was thinking about my problem wrong though. I should have been using a
> > custom type. I have a task that produces XML reports and writes them to
> > disk. I wanted the task to take a set of nested elements that describe
the
> > list of reports to create.
> >
> > Unfortunately my problem is now finding where the typedef element is
> > expected in the build file. I assume that it should be in the project
> > element before it is used.
> >
> > Ant gives me the following error whereever I put the typedef element:
> >
> > 10: Unexpected element "typedef"
> >
> >
> > G. Angus McCollum
> >
> > -----Original Message-----
> > From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
> > Sent: Wednesday, September 26, 2001 5:42 PM
> > To: ant-user@jakarta.apache.org
> > Subject: Re: Are all nexted elements implemented as DataType extensions?
> >
> >
> > Have a look at the Sequential and Parallel built-in Ant tasks (in
> > Ant 1.4).
> > They implement TaskContainer.  That should point you in the right
> > direction
> > for implementing a task that contains other tasks.
> >
> >     Erik
> >
> >
> > ----- Original Message -----
> > From: "McCollum , Angus" <AMcCollum@grow.net>
> > To: <ant-user@jakarta.apache.org>
> > Sent: Wednesday, September 26, 2001 1:43 PM
> > Subject: Are all nexted elements implemented as DataType extensions?
> >
> >
> > > I created a custom Ant task with a nested element. I had writen
> > the nested
> > > element as a Task but failed to get the addXXXX method called on the
> > > enclosing task.
> > >
> > > I took a look at the Ant source and noticed that all the
> > examples I found
> > > used nested element that were DataTypes and not Tasks. Is this
> > always the
> > > case? Should I have structed my nested element as a DataType and not a
> > Task?
> > >
> > > Thank you in advance.
> > >
> > > G. Angus McCollum
> > >
> >
>


Mime
View raw message