[ 
https://issues.apache.org/jira/browse/VELOCITY-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16651842#comment-16651842
 ] 

Thomas Mortagne commented on VELOCITY-892:
------------------------------------------

bq. Basically, you need to be able to define several converters, String -> 
List<String>, String -> List<Integer> , String -> List<Color>, ...

Yes.

bq. Would any of the proposed workarounds fit your case? Otherwise, may I ask, 
is this feature used a lot? 

Type with generics are used a lot in input in XWiki yes.

bq.  Basically, I'm not even sure that this conversion does deserve to be 
implicit. After all, the separator can vary, there can be beginning and ending 
normal/square/curly brackets, or other parsing issue...

I gave List as an example because it's well know type but it's the same for 
many other types.

bq. Would any of the proposed workarounds fit your case? Otherwise, may I ask, 
is this feature used a lot? 

No because we have this feature since a long time and it's used already.

Having Type instead of Class in the API does not make much difference for 
Velocity and give more power to the converter so I don't really see what is the 
issue exactly. It's really not a blocker since it's not like it was super hard 
to maintain our uberspector but it's a pity to not have a better API at 
Velocity level.

> Method arguments conversions should be based on Type instead of Class
> ---------------------------------------------------------------------
>
>                 Key: VELOCITY-892
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-892
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 2.0
>            Reporter: Thomas Mortagne
>            Priority: Major
>             Fix For: 2.0
>
>
> I was happy to see that method arguments conversion has been added to 2.0 so 
> that I can remove the uberspector we have on XWiki side but unfortunately 
> ConversionHandler is limited to classes which is way too restrictive for us 
> (for example if the parameter type is List<String> it won't do the same thing 
> than if the type is List<Integer>).
> Our uberspector can be found on 
> https://github.com/xwiki/xwiki-commons/blob/master/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/MethodArgumentsUberspector.java
>  to see what we do exactly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to