集册 Java实例教程 获取通用类型

获取通用类型

欢马劈雪     最近更新时间:2020-01-02 10:19:05

457
获取通用类型

// This program is free software: you can redistribute it and/or modify

//package com.nowjava;

import java.lang.reflect.*;
/** from n  o  w  j  a  v  a . c o m**/

public class Main {

    public static Type[] getGenericTypes(ParameterizedType t) {

        if (t == null)

            return new Type[] {};

        else

            return t.getActualTypeArguments();

    }

}