I would like someone to either confirm or deny some assumptions I'm makeing
on how subelements get pulled into custom tasks.

The documentation Stefan refers to below doesn't really give a lot of
informaiton on when you should use createXXX vs addXXX.  It also doesn't
give much information on how they are supposed to work, and what they are
supposed to do.  So, here are my assumptions:

createXXX: The object returned must be a class that has appropriate setXXX
methods for any of the elements attributes and createXXX or addXXX methods
for any nested subelements. ant will then call these methods for any
attributes and subelements that are present.

addXXX; The object passed in has been instantiated by ant with a
no-argument constructor.  It must also have setXXX methods for any
attributes and createXXX or addXXX methods for any nested subelements.  ant
will have already called these methods for any attributes and subelements
that are present.

So, how'd I do?

Marc Robertson
DST Systems, Inc.


                                                                                       
                          
                    Stefan                                                             
                          
                    Bodewig              To:     [EMAIL PROTECTED]           
                          
                    <bodewig@apac        cc:                                           
                          
                    he.org>              Subject:     Re: Sub-element question         
                          
                                                                                       
                          
                    11/14/01                                                           
                          
                    07:55                                                              
                          
                    Please                                                             
                          
                    respond to                                                         
                          
                    "Ant Users                                                         
                          
                    List"                                                              
                          
                                                                                       
                          
                                                                                       
                          




On Wed, 14 Nov 2001, Mark Claassen <[EMAIL PROTECTED]> wrote:

> I am trying to write a custom task and I need to have a subelement
> in it

See <http://jakarta.apache.org/ant/manual/develop.html> list element 5
in the first section.

> like the following example.
>
> <target name = "Task">
>    <SubSection>
>         <element1/>
>         <element2/>
>         ...
>    </SubSection>
> </target>

The class corrsponding to SubSection needs methods like

public Foo createElement1()

or

public void addElement2(Bar aBar)

Stefan

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to