Here you can find the source of getMethodDescriptor(Object instance, String methodName, Class extends Object> aClass, Class>... parameters)
public static Method getMethodDescriptor(Object instance, String methodName, Class<? extends Object> aClass, Class<?>... parameters) throws NoSuchMethodException
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Red Hat, Inc./*from w w w . java2 s . com*/ * Distributed under license by Red Hat, Inc. All rights reserved. * This program is 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: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.lang.reflect.Method; public class Main { public static Method getMethodDescriptor(Object instance, String methodName, Class<? extends Object> aClass, Class<?>... parameters) throws NoSuchMethodException { notNull(instance, "instance"); Method method = aClass.getDeclaredMethod(methodName, parameters); method.setAccessible(true); return method; } public static <T> T notNull(T value, String message) { if (value == null) { throw new IllegalArgumentException(message); } return value; } public static Method getDeclaredMethod(Class<?> aClass, String name) throws NoSuchMethodException { try { return aClass.getDeclaredMethod(name); } catch (NoSuchMethodException e) { Class<?> superclass = aClass.getSuperclass(); if (aClass == Object.class || superclass == null) { throw e; } else { return getDeclaredMethod(superclass, name); } } } }