I think you're right. I don't see any good reason why you shouldn't be
able to pass in a Type and Class<?> arguments. That said, you could fake
this by implementing ParameterizedType, populating it with the right
values and passing it in.
I would file a RFE against JAX-RS asking for a new constructor with
(Type, Class<?>) arguments.
Gili
On 20/11/2014 7:11 PM, Robert DiFalco wrote:
> No, I want to transform a List.class and (for example) a String.class
> into a "new GenericType<List<String>>(){}." I have a Type for List and
> a Type for String but I don't have a ParameterizedType for
> List<String>.class.
>
> On Thu, Nov 20, 2014 at 3:38 PM, cowwoc <cowwoc_at_bbs.darktech.org
> <mailto:cowwoc_at_bbs.darktech.org>> wrote:
>
> I don't understand. You want to transform "Class<T> type" into
> "List<T>"? I don't think that's possible (or necessary) because
> "List<T>" is actually a "List". You can just construct a List and
> cast it to the right type and you will end up with as much runtime
> information as your proposed solution.
>
> Gili
>
>
> On 20/11/2014 5:34 PM, Robert DiFalco wrote:
>
> Why isn't it possible to construct a GenericType if I know
> getType and getRawType?
>
> My situation is something like this:
>
> public <T> List<T> listType(Class<T> type) {
> return new GenericType(List.class, type);
> }
>
> Seems like that should be possible. What am I missing about
> erasure? In GenericType wouldn't new
> GenericType<List<String>>{} create a type of List.class with a
> rawType of String.class? Why can't that be done
> programmatically if I know the two types?
>
> Thanks!
>
>
>