Here you can find the source of getMethod(String methodName, Object instance)
Parameter | Description |
---|---|
methodName | a parameter |
instance | a parameter |
public static Method getMethod(String methodName, Object instance)
//package com.java2s; import java.lang.reflect.Method; public class Main { /**/*from w w w . j a v a 2s . com*/ * get Method Name * * @param methodName * @param instance * * @return Method */ public static Method getMethod(String methodName, Object instance) { Method[] methods = instance.getClass().getMethods(); for (Method m : methods) { if (m.getName().equalsIgnoreCase(methodName)) { return m; } } return null; } }