Here you can find the source of getMethodReturnType(Class> clazz, String name)
public static Class<?> getMethodReturnType(Class<?> clazz, String name)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static Class<?> getMethodReturnType(Class<?> clazz, String name) { if (clazz == null || name == null || name.isEmpty()) { return null; }//from w w w .j a v a2 s . c o m name = name.toLowerCase(); Class<?> returnType = null; for (Method method : clazz.getDeclaredMethods()) { if (method.getName().equals(name)) { returnType = method.getReturnType(); break; } } return returnType; } }