package com.jay.monitor.data.client.utils;

import java.lang.reflect.ParameterizedType;

/**
 * @Module TODO
 * @Description TODO
 * @Author liukaixiong
 * @Date 2020/11/2 10:49
 */
public class ClassUtils {

    public static Class getClassType(Class cla, int index) {
        try {
            return (Class) ((ParameterizedType) cla.getGenericSuperclass()).getActualTypeArguments()[index];
        } catch (Exception e) {
            Class superclass = cla.getSuperclass();
            if (superclass != null) {
                return getClassType(superclass, 0);
            }
            return null;
        }
    }

}
