ParameterizedType.getOwnerType() has the following syntax.
Type getOwnerType()
In the following code shows how to use ParameterizedType.getOwnerType() method.
import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; //w ww. j a v a 2 s .co m public class Main { public static void main(String args[]) throws Exception { Type type = StringList.class.getGenericSuperclass(); System.out.println(type); ParameterizedType pt = (ParameterizedType) type; Type ownerType = pt.getOwnerType(); System.out.println(ownerType); } } class StringList extends ArrayList<String> { }
The code above generates the following result.