--- Michael O'Connor <[EMAIL PROTECTED]> wrote:
> Help!
on the way :)
> It strikes me that with all the iterative 'loop'
> tags (block tags) within
> XDoclet, there must be a generic tag that checks the
> condition "this is the
> last / first / nth iteration in the loop"...  I
> can't find one though!

I'll tell you truth: there is no such tag. And it's
unlikely that one will emerge soon ( before 2.0 )

Current templating language is not very good
( you must have figured it yourself ), and all the 
iterations are defined in various tag handlers,
so we just can not produce generic tag which would
check for last iteration. 

> I'm writing an xdoclet template to auto-generate
> JUnit tests for the EJBs
> I'm making in my current project, and part of my
> template looks like this:
> 
> MyObject = new MyObject(
>     <XDtEjbPersistent:forAllPersistentFields>
>         TEST_<XDtMethod:methodNameWithoutPrefix/>,
>     </XDtEjbPersistent:forAllPersistentFields>
> );
> 
> This iterates through all persistent fields in the
> EJB, and for each one
> outputs a variable name beginning with "TEST_", and
> the whole thing is
> surrounded by "MyObject = new MyObject(.....);" 
> E.g. given the fields
> "UserId", "Colour" and "Age" - the desired output
> would be:
> 
> MyObject = new MyObject(TEST_UserId, TEST_Colour,
> TEST_Age);
> 
> So far so good.  The problem is that after each
> iteration the template puts
> a comma, including the *last* iteration - so what I
> actually get is the list
> with a comma at the end:
> 
> MyObject = new MyObject(TEST__UserId, TEST_Colour,
> TEST_Age , );
> 
> And this is very annoying!!  (at least the Java
> compiler seems to think so..
> ;o)   What I'm thinking of is something like the
> following
> <XDtUtil:ifNotLast> tag to control when to include
> the comma in the output:
> 
> MyObject = new MyObject(
>     <XDtEjbPersistent:forAllPersistentFields>
>         TEST_<XDtMethod:methodNameWithoutPrefix/>
>         <XDtUtil:ifNotLast>,</XDtUtil:ifNotLast>,
>     </XDtEjbPersistent:forAllPersistentFields>
> );
> 
> Any answers would be very much appreciated!         

Hmm, there are tags dooing similar stuff for patameter
lists for DataObject / Value object - and you will be
able to use them, since you have living EJB to work
with:
<XDtEjbPersistent:persistentfieldList
superclasses="true"/> will produce parameter
definition list

<XDtEjbPersistent:persistentfieldNameValueList/>
produce list without type names to be used for
invocations. 

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to