Np, FYI there was a bug in CXF, fixed for 3.1.8-SNAPSHOT:
https://issues.apache.org/jira/browse/CXF-6992

Sergey
On 06/10/16 14:16, Christian Balzer wrote:
Thanks.

So, I suppose I could do (((ParameterizedType)
genericType).getActualTypeArguments() to get hold of the actual
Integer in your example, if I'm not mistaken. Useful to know for next
time. :)

Regards,
Christian

On Thu, Oct 6, 2016 at 1:32 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
Hi Christian


If you have something like

MyType<Integer>

then the generic type will help the converter implementation to figure out
that MyType is parameterized by Integer.

If you have List<MyType<Integer>> then as I noted earlier the List will be
created by the runtime while individual matrix/query etc properties will be
converted to MyType<Integer> by the converter

Sergey


On 06/10/16 00:33, Christian Balzer wrote:

Hi all,

This is probably the wrong place, but...

Can anyone explain to me in plain simple English what the genericType
parameter below is good for, please?

public class FooHandler implements ParamConverterProvider {
    @Override
    public <T> ParamConverter<T> getConverter(final Class<T> rawType,
Type genericType, Annotation[] annotations) {

I'm afraid I don't quite understand the JavaDoc from

https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/ParamConverterProvider.html
- and I couldn't find an example anywhere...

From the docs:

genericType - the type of object to be converted. E.g. if an String
value representing the injected request parameter is to be converted into a
method parameter, this will be the formal type of the method parameter as
returned by Class.getGenericParameterTypes. <<


From that, I would have expected that for this method signature:

public Response foo(@MatrixParam("l") List<String> myList) {

genericType would be String?

As in:

if an String value ["abc"] representing the injected request parameter
[";l", i.e. ";l=abc"] is to be converted into a method parameter [myList],
this will be the formal type [<String>] of the method parameter
[List<String>] as returned by Class.getGenericParameterTypes. <<


Am I close?

Kind regards,

Christian



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to