Here you can find the source of getMethod(Object pojo, String methodName, Class>[] params)
Parameter | Description |
---|---|
pojo | a parameter |
methodName | a parameter |
params | a parameter |
public static Method getMethod(Object pojo, String methodName, Class<?>[] params)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { /**/*from ww w. j ava2s. c o m*/ * * @param pojo * @param methodName * @param params * @return */ public static Method getMethod(Object pojo, String methodName, Class<?>[] params) { Method method = null; Class<?> cClass = pojo.getClass(); while (cClass != null && method == null) { try { method = cClass.getDeclaredMethod(methodName, params); } catch (NoSuchMethodException nsf) { cClass = cClass.getSuperclass(); } } return method; } }