Here you can find the source of getMethod(Class> c, String name)
Parameter | Description |
---|---|
c | The class |
name | The name |
public static Method getMethod(Class<?> c, String name)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.*; public class Main { /**/*from w w w . j a v a 2 s . c om*/ * Get method by name (declared) * * @param c The class * @param name The name * @return The method */ public static Method getMethod(Class<?> c, String name) { for (Method m : c.getMethods()) { if (m.getName().equals(name)) return m; } return null; } }