Here you can find the source of getMethodFromClassHierarchy(Class> clazz, String methodName)
public static Method getMethodFromClassHierarchy(Class<?> clazz, String methodName) throws NoSuchMethodException
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { /**/*from w ww . j a v a 2 s . co m*/ * Searches for the method within class hierarchy * * @return */ public static Method getMethodFromClassHierarchy(Class<?> clazz, String methodName) throws NoSuchMethodException { while (clazz != null) { for (Method method : clazz.getDeclaredMethods()) { if (method.getName().equals(methodName)) { return method; } } clazz = clazz.getSuperclass(); //NOSONAR } throw new NoSuchMethodException(methodName); } }