Java Reflection Method Get from Object getMethod(Object o, String methodName, Class[] paramTypes)

Here you can find the source of getMethod(Object o, String methodName, Class[] paramTypes)

Description

get Method

License

Open Source License

Parameter

Parameter Description
o a parameter
methodName a parameter
paramTypes a parameter

Exception

Parameter Description
NoSuchMethodException an exception

Declaration

public static Method getMethod(Object o, String methodName, Class[] paramTypes) throws NoSuchMethodException 

Method Source Code


//package com.java2s;
import java.lang.reflect.Method;

public class Main {
    /**//from  ww  w . j a  v  a  2  s  .c  om
     *
     *
     * @param o
     * @param methodName
     * @param paramTypes
     * @return
     * @throws NoSuchMethodException
     */
    public static Method getMethod(Object o, String methodName, Class[] paramTypes) throws NoSuchMethodException {
        Class clz = o.getClass();
        return clz.getMethod(methodName, paramTypes);
    }

    /**
     *
     *
     * @param clz
     * @param methodName
     * @param paramTypes
     * @return
     * @throws NoSuchMethodException
     */
    public static Method getMethod(Class clz, String methodName, Class[] paramTypes) throws NoSuchMethodException {
        return clz.getMethod(methodName, paramTypes);
    }
}

Related

  1. getMethod(Object bean, String propertyName)
  2. getMethod(Object instance, String methodName, Class... argsClass)
  3. getMethod(Object instance, String methodName, Class[] parameters)
  4. getMethod(Object o, String methodName)
  5. getMethod(Object o, String methodName, Class[] args)
  6. getMethod(Object obj, Class[] paramTypes, String methodName)
  7. getMethod(Object obj, String fieldName)
  8. getMethod(Object obj, String methodName)
  9. getMethod(Object obj, String methodName, Class paramClass)