Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; import java.util.*; public class Main { public static Method findMethod(Object target, List<String> possible_names, Class<?>... parameter_types) { if (target == null) return null; return findMethod(target.getClass(), possible_names, parameter_types); } public static Method findMethod(Class<?> root_class, List<String> possible_names, Class<?>... parameter_types) { for (Class<?> clazz = root_class; clazz != null; clazz = clazz.getSuperclass()) { for (String name : possible_names) { try { return clazz.getDeclaredMethod(name, parameter_types); } catch (Exception e) { } } } return null; } }