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> 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!
>>
>
>