Extract full attribute types from a java file

37 views Asked by At

So i need to extract the types of attributes from java files. I am currently using the parser qdox to do this. It works fine for the most part.

The problem is that when I have attributes that have a type like this List<String> I need to get the full name of String i.e java.lang.String.

But it seems that qdox canĀ“t extract the full name of the generic typ. Is there any way to get it?

1

There are 1 answers

0
Karol Dowbecki On

Generics are not preserved in the runtime due to Type Erasure.

You can inspect every element in the List but the <String> part of the type is not accessible for running program.