users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Can't pass in type information to Invoke

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 21 Dec 2011 10:05:40 -0500

I have a case where I calculate generic type information a bit
differently than the specification intends. The problem is that there
is no way to pass this generic information to Invocation, SyncInvoker,
or AsyncInvoker. i.e.

Type genericType = ...;
Class type = ...;

There no way to pass this information to Invocation, SyncInvoker,
AsyncInvoker, or override TypeLiteral in some way. Are you following me yet?

Solution 1:

Add additional methods to Invocation, SyncInvoker, and AsyncInvoker:

<method>(Class<T> type, Type genericType);

Solution 2: Make TypeLiteral non abstract and add a constructor

public class TypeLiteral<T> {

    public TypeLiteral(Class<T> type, Type genericType) {
      this.rawType = type;
      this.type = genericType;
    }
}

You might also want to move logic out of getType() and
getParameterTypes() into the protected constructor.

http://java.net/jira/browse/JAX_RS_SPEC-156


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