Here you can find the source of getGenericReturnClass(Method method)
@SuppressWarnings("unchecked") public static Class getGenericReturnClass(Method method)
//package com.java2s; /*//from ww w .ja va2s. c o m * $RCSfile: GenericsUtils,v $$ * $Revision: 1.0 $ * $Date: 2011 $ * * Copyright (C) 2011 GyTech, Inc. All rights reserved. * * This software is the proprietary information of GyTech, Inc. * Use is subject to license terms. */ import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { @SuppressWarnings("unchecked") public static Class getGenericReturnClass(Method method) { Class returnClazz = method.getReturnType(); Type genType = method.getGenericReturnType(); if (genType instanceof ParameterizedType) { Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); if ((params != null) && (params.length >= 0)) { returnClazz = (Class) params[0]; } } return returnClazz; } }