users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Is ParamConverterProvider needed ?

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 18 Sep 2012 16:14:40 -0400

I guess if you were matching based solely on annotation, then yes
Provider would be needed. Ok...still a bit overkill. Client-side is
still going to have to do it dynamically. I'd say ditch this idea of
matching based on annotation, and stick to a class/generic type hash lookup.

On 9/18/2012 10:13 AM, Marek Potociar wrote:
> With provider any pre-computations can be done once during deploy-time. With just converter you'd have to do these every single time you need the converter.
>
> Marek
>
> On Sep 18, 2012, at 3:41 AM, Bill Burke <bburke_at_redhat.com> wrote:
>
>> I still don't get why we need ParamConverterProvider. Just widen fromString and toString
>>
>> ParamConverter<T> {
>>
>> fromString(Class type, Type genericType, Annotation[] annotations);
>> toString(Object obj, Annotation[] annotations)
>> }
>>
>> Correct me if i'm wrong, but the model with ParamConverterProvider is inefficient as you'd have to loop over every registered converter to until you got one that matched. Instead, you can match the type to the generic parameter passed when implementing the ParamConverter interface. Just like we do with ExceptionMapper.
>>
>> On 9/6/2012 8:49 AM, Marek Potociar wrote:
>>> Please check the user comment in the corresponding issue for the motivation:
>>> http://java.net/jira/browse/JAX_RS_SPEC-61
>>>
>>> Marek
>>>
>>> On Sep 4, 2012, at 6:38 PM, Sergey Beryozkin <sberyozkin_at_talend.com
>>> <mailto:sberyozkin_at_talend.com>> wrote:
>>>
>>>> Hi
>>>>
>>>> We have ParamConverterProvider and ParamConverter, I wonder do we
>>>> really need the former ?
>>>>
>>>> Example, individual ExceptionMapper implementations can be registered
>>>> as providers, why should ParamConverter implementations be created
>>>> indirectly via ParamConverterProvider ?
>>>>
>>>> I can see ParamConverterProvider allows to find the providers for
>>>> arguments like "List<Book>" - but do we really need it ?
>>>>
>>>> Sergey
>>>
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com