Java Reflection Method Name getMethod(String className, String methodName, Class[] params)

Here you can find the source of getMethod(String className, String methodName, Class[] params)

Description

get Method

License

Open Source License

Parameter

Parameter Description
className a parameter
methodName a parameter
params a parameter

Exception

Parameter Description
ClassNotFoundException an exception
NoSuchMethodException an exception
SecurityException an exception

Return

Returns the Method object from the specified class name, method name and parameters of this method.

Declaration

public static Method getMethod(String className, String methodName, Class<?>[] params)
        throws ClassNotFoundException, NoSuchMethodException, SecurityException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Method;

public class Main {
    /**//  w ww .  ja  v  a 2  s . c  om
     * 
     * @param className
     * @param methodName
     * @param params
     * 
     * @return Returns the Method object from the specified class name, method name and parameters of this method.
     * 
     * @throws ClassNotFoundException
     * @throws NoSuchMethodException
     * @throws SecurityException
     */
    public static Method getMethod(String className, String methodName, Class<?>[] params)
            throws ClassNotFoundException, NoSuchMethodException, SecurityException {
        Class<?> clazz = Class.forName(className);
        return clazz.getMethod(methodName, params);
    }
}

Related

  1. getMethod(Method[] methods, String name)
  2. getMethod(Method[] methods, String name, Class[] params)
  3. getMethod(String className)
  4. getMethod(String className, String functionName, Class[] paramTypes)
  5. getMethod(String className, String functionName, Class[] paramTypes)
  6. getMethod(String methodName, Class clazz)
  7. getMethod(String methodName, Class clazz, Class... args)
  8. getMethod(String methodName, Class klass)
  9. getMethod(String methodName, Class type)