users@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 17 Sep 2012 21:41:17 -0400

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