Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.ParameterizedType;

public class Main {

    public static Class<?> getRspClass(Class<?> cbkClass) {
        try {
            java.lang.reflect.Type type = cbkClass.getGenericSuperclass();
            if (type instanceof ParameterizedType) {
                ParameterizedType parameterizedType = (ParameterizedType) type;
                Class<?> cls = (Class<?>) parameterizedType.getActualTypeArguments()[0];
                return cls;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}