Java Reflection Method Name getMethod(Class clazz, String methodName, Class... params)

Here you can find the source of getMethod(Class clazz, String methodName, Class... params)

Description

get Method

License

Apache License

Declaration

public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Method;

public class Main {
    public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params) {
        try {//from ww  w  .ja  va2s. com
            return clazz.getDeclaredMethod(methodName, params);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(
                    String.format("Cannot find method (%s) on class (%s)", methodName, clazz.getCanonicalName()),
                    e);
        }
    }
}

Related

  1. getMethod(Class c, String name)
  2. getMethod(Class c, String name, Class[] args)
  3. getMethod(Class clazz, String methodName)
  4. getMethod(Class clazz, String methodName, Class fieldType)
  5. getMethod(Class clazz, String methodName, Class... arguments)
  6. getMethod(Class clazz, String methodName, Class... params)
  7. getMethod(Class clazz, String methodName, Class... params)
  8. getMethod(Class clazz, String methodName, Class... params)
  9. getMethod(Class clazz, String methodName, final Class[] classes)