You can loop over method tags, param, etc but what you need is an
iterator over the value of a parameter which you assume is an integer.
There's no built-in tag for such a usage (haven't needed such a thing)
so you should write a tag. Create a new namespace and define the tag in
it, say forAllPosition which in its impl does a getTagsByName(
getCurrentMethod(), "myspace:my-parameter" ) and getParameter()'s the
parameter, converts/validates it to int, keeps the value in a class
variable and does a generate(template) for each one. You should also
define a positionValue tag to return current position value and stuff
like that.

Ara.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:xdoclet-user-
> [EMAIL PROTECTED]] On Behalf Of J�r�me BERNARD
> Sent: Friday, January 18, 2002 7:10 PM
> To: [EMAIL PROTECTED]
> Subject: [Xdoclet-user] Templates and position?
> 
> How can I use the template engine in order to know the position of the
> tag within a forAll loop?
> 
> For example suppose I have the following input:
> 
> /**
>   * @myspace:my-tag description="Do some crazy stuff."
>   * @myspace:my-parameter name="firstObject" position="0"
> description="My first object."
>   * @myspace:my-parameter name="secondObject" position="1"
> description="My second object."
>   */
> public int doSomeCrazyStuff(Object firstObject, Object secondObject) {
> return -1; }
> 
> 
> I would like to have such an output:
> 
> public void myName(int index) {
>   switch (index) {
>     case 0:
>       return "firstObject";
>     case 1:
>       return "secondObject";
>   }
> }
> 
> public void myDescription(int index) {
>   switch (index) {
>     case 0:
>       return "My first object."
>     case 1:
>       return "My second object.
>   }
> }
> 
> 
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to