| 假如我们要想获得 Vector<Date> v = new Vector<Date>(); v的实际类型参数 我们必须写一个如applyRef的方法
 我们不能通过v.getClass()这样的代码得到Vector<>里的参数化,只能通过其他途径得到。
 复制代码public class Dao {
     
    public void applyRef1(Map<String,Integer> map,Vector<Date> v){
         
    }
     
    public static void main(String[] args) {
        try {
            Method method = new Dao().getClass().getMethod("applyRef1", Map.class,Vector.class) ;
             
            Type[] pType = method.getParameterTypes();
             
            Type[] neiType = method.getGenericParameterTypes();
           
            System.out.println(pType[0]) ;
            System.out.println(pType[1]) ;
             
            System.out.println(neiType[0]) ;
            System.out.println(neiType[1]) ;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
 |