Here you can find the source of getMethod(Object target, String methodName, Class... parameterTypes)
Parameter | Description |
---|---|
target | target object |
methodName | method name |
parameterTypes | method parameter types |
public static Method getMethod(Object target, String methodName, Class... parameterTypes)
//package com.java2s; /*//from ww w.j a v a 2 s. c om * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ import java.lang.reflect.Method; public class Main { /** * Get target method * * @param target target object * @param methodName method name * @param parameterTypes method parameter types * * @return return value */ public static Method getMethod(Object target, String methodName, Class... parameterTypes) { try { return target.getClass().getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(e); } } }