Here you can find the source of getGenericFirst(Object obj)
public static Class getGenericFirst(Object obj)
//package com.java2s; //License from project: Apache License import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { public static Class getGenericFirst(Object obj) { Type type = (Type) obj.getClass().getGenericSuperclass(); ParameterizedType pt = (ParameterizedType) type; Class classz = ((Class) pt.getActualTypeArguments()[0]); return classz; }/*from www . j ava 2 s. c o m*/ }