📜  从泛型类型 java 代码示例中获取类

📅  最后修改于: 2022-03-11 14:52:48.102000             🧑  作者: Mango

代码示例1
class Foo {
    final Class typeParameterClass;

    public Foo(Class typeParameterClass) {
        this.typeParameterClass = typeParameterClass;
    }

    public void bar() {
        // you can access the typeParameterClass here and do whatever you like
    }