Java examples for Reflection:Generic
dig From Generic Type
//package com.java2s; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { static Class<?> digFromGenericType(Type genericType) { Type[] typeArguments = ((ParameterizedType) genericType) .getActualTypeArguments(); Type type = typeArguments[0]; if (type instanceof ParameterizedType) { return digFromGenericType(type); } else {//from ww w. j a v a 2 s. c o m return (Class<?>) type; } } }