package com.xty.common

import java.lang.reflect.ParameterizedType

class ReflexUtils {
    companion object{
        //反射获取当前传入泛型的对象
        fun getSuperType(act:Class<Any>):Class<Any>?{
            val parameterizedType = act.genericSuperclass as ParameterizedType
            val actualTypeArguments = parameterizedType.actualTypeArguments
            return if(actualTypeArguments.isNotEmpty()) {
                return  actualTypeArguments[0] as Class<Any>
            }else{
                return  null
            }
        }
    }


}