Here you can find the source of getMethod(Object obj, Class[] paramTypes, String methodName)
Parameter | Description |
---|---|
obj | Class in which the method is. |
paramTypes | types of the arguments. |
methodName | the name of the method. |
Parameter | Description |
---|---|
NoSuchMethodException | an exception |
@SuppressWarnings("rawtypes") public static Method getMethod(Object obj, Class[] paramTypes, String methodName) throws NoSuchMethodException
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { /**/*from w w w.jav a 2 s .c om*/ * Get the method given in string in input corresponding to the given * arguments. * * @param obj * Class in which the method is. * @param paramTypes * types of the arguments. * @param methodName * the name of the method. * @return Methood * * @throws NoSuchMethodException */ @SuppressWarnings("rawtypes") public static Method getMethod(Object obj, Class[] paramTypes, String methodName) throws NoSuchMethodException { Method method = obj.getClass().getMethod(methodName, paramTypes); return method; } }