在java中返回泛型的类对象

时间:2013-10-17 05:12:58

标签: java generics

在下面的代码中,我将类T作为通用“参数”,我需要在其中一个方法中返回类似“T.class”的内容。我该怎么做?

public abstract class GenericLogPartitioner<K, V, T extends FileInputFormat<K, V>> extends LogPartitioner {



    @Override
    protected Class<? extends FileInputFormat> getInputFormatClass() {
        return T.getClass(); //what should be here. I need to return T
    }

0 个答案:

没有答案
相关问题