You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Christopher Schultz (JIRA)" <de...@velocity.apache.org> on 2007/04/23 19:55:15 UTC

[jira] Updated: (VELOCITY-533) Treat arrays like fixed-length lists

     [ https://issues.apache.org/jira/browse/VELOCITY-533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Schultz updated VELOCITY-533:
-----------------------------------------

    Attachment: PrimitiveArrayWrapper.java

Per discussion on the developer list, I am including a class that can wrap a primitive array (any array, actually) and provide collection-like access to it.

Requires Java 1.2 or better since it uses the Java Collections API.


> Treat arrays like fixed-length lists
> ------------------------------------
>
>                 Key: VELOCITY-533
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-533
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Nathan Bubna
>            Priority: Minor
>             Fix For: 1.6
>
>         Attachments: PrimitiveArrayWrapper.java
>
>
> I'd like to see arrays treated like fixed-length List objects as much as possible.  This means auto-magically supporting size(), set(int,Object), get(int), and isEmpty() at a minimum.  Support for something like iterator() probably isn't necessary, since #foreach already handles arrays, but it might be good for completeness.  These should be possible via some Uberspect hackery.
> And since the goal is to free template authors from having to care about the differences between Lists and arrays, we might also consider supporting conversion between the two for method calls, so:
> $foo.wantsListHere($thisisAnArray)
> and
> $bar.wantsArrayHere($thisisAList)
> both work automatically.   I haven't yet looked into what it would take to do this.   If it is too hard or messy, i could be happy with just support for calling List methods on arrays.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org