Here you can find the source of getMethod(Class objClass, String methodName, Class argClass)
Parameter | Description |
---|---|
objClass | a parameter |
methodName | a parameter |
argClass | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static Method getMethod(Class objClass, String methodName, Class argClass) throws Exception
//package com.java2s; import java.lang.reflect.Method; public class Main { /**//from w w w. ja v a2 s .c om * get Method * * @param objClass * @param methodName * @param argClass * @return Method * @throws Exception */ public static Method getMethod(Class objClass, String methodName, Class argClass) throws Exception { Class argClasses[] = (argClass == null) ? null : new Class[] { argClass }; return getMethod(objClass, methodName, argClasses); } /** * get Method * * @param objClass * @param methodName * @param argClasses * @return * @throws Exception */ public static Method getMethod(Class objClass, String methodName, Class argClasses[]) throws Exception { Method method = null; try { method = objClass.getDeclaredMethod(methodName, argClasses); } catch (Exception e) { } if (method == null) { try { method = objClass.getMethod(methodName, argClasses); } catch (Exception e) { // logger.debug(e); } } return method; } }