Here you can find the source of getMethod(final Class extends Object> clazz, final String methodName, final Class>[] parTypes, final Object[] parameters)
private static Method getMethod(final Class<? extends Object> clazz, final String methodName, final Class<?>[] parTypes, final Object[] parameters) throws NoSuchMethodException
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 SAP AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from ww w . j a v a 2 s . c o m * SAP AG - initial API and implementation *******************************************************************************/ import java.lang.reflect.Method; public class Main { private static Method getMethod(final Class<? extends Object> clazz, final String methodName, final Class<?>[] parTypes, final Object[] parameters) throws NoSuchMethodException { assert clazz != null && methodName != null && parTypes != null && parameters != null; try { return clazz.getDeclaredMethod(methodName, parTypes); } catch (NoSuchMethodException e) { final Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { return getMethod(superClass, methodName, parTypes, parameters); } throw e; } } }