[ 
http://issues.apache.org/jira/browse/VELTOOLS-69?page=comments#action_12450204 
] 
            
Nathan Bubna commented on VELTOOLS-69:
--------------------------------------

Velocity doesn't actually convert references to anything but strings, and it is 
only in 1.5 that the rendered string values are used in comparisons when the 
types of the arguments do not match.   As for method arguments, Velocity only 
converts primitives to Objects and vice versa.

So, no, conversion of native datatypes is not something Velocity does much of 
for you.  Of course, i don't recommend heavy use of in-template conversion, but 
nonetheless, they are sometimes necessary and are thus necessarily supported by 
generic tools, especially the ValueParser, which was designed for precisely and 
almost exclusively that purpose.

Allowing periods in keys in the Velocity engine would have quite a few 
implications, and i'm not sure how difficult it would be to implement (or at 
least, to implement consistently.  Something to think about though...

Anyway, i've poked around the Velocity internals and tried a few things, but i 
don't think i can get the sub working without losing backward compatibility in 
at least a few cases.  So, it needs to come out for 1.3.

Thanks for bringing this up!


> ValueParserSub generic getter never worked
> ------------------------------------------
>
>                 Key: VELTOOLS-69
>                 URL: http://issues.apache.org/jira/browse/VELTOOLS-69
>             Project: VelocityTools
>          Issue Type: Bug
>          Components: VelocityView
>    Affects Versions: 1.3
>            Reporter: Claude Brisson
>         Attachments: valueparser.patch
>
>
> (I attach this issue to the VelocityView component but we may need a Generic 
> component in Jira)
> When $query is the ValueParser object for the query string http://...?foo=5,
> then $query.foo.int is an invalid reference.
> Why? Because there is a collision of variable names in 
> ValueParserSub.get(Object key).
> I profit of this opportunity to state that I really don't like the 
> ValueParserSub class, because it breaks the "#if($query.foo)" syntax. Hence, 
> it is not backward compatible. Or at least, it could return null for an 
> unexistant key.
> Is it really usefull to keep it now that Velocity handles conversions much 
> better? Since obviously nobody used the $query.foo.int feature, it is still 
> time to remove it... Also, since the need to convert between types can emerge 
> elsewhere, it would be much cleaner to have a standalone converter object. 
> Yes, we loose the syntax $query.foo.int, but is it that nice a syntax?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to