Java Reflection Method Parameter getMethod(final Class clazz, final String name, final Class... parameterTypes)

Here you can find the source of getMethod(final Class clazz, final String name, final Class... parameterTypes)

Description

Returns the matched public method of the specified class or null if no such method

License

Apache License

Parameter

Parameter Description
clazz The represented class
name The name of method
parameterTypes The parameter types of method

Return

the matched method or null if not found

Declaration

public static Method getMethod(final Class<?> clazz, final String name, final Class<?>... parameterTypes) 

Method Source Code

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

import java.lang.reflect.Method;

public class Main {
    /**/*from  w  w  w. jav a2  s .  c o  m*/
     * Returns the matched public method of the specified class or null if no
     * such method
     * 
     * @param clazz
     *            The represented class
     * @param name
     *            The name of method
     * @param parameterTypes
     *            The parameter types of method
     * @return the matched method or null if not found
     */
    public static Method getMethod(final Class<?> clazz, final String name, final Class<?>... parameterTypes) {
        try {
            return clazz.getMethod(name, parameterTypes);
        } catch (final Exception e) {
            return null;
        }
    }
}

Related

  1. getMethod(final Class clazz, final String name, final Class... parameterTypes)
  2. getMethod(final Class javaClass, final String methodName, final Class[] methodParameterTypes, final boolean shouldSetAccessible)
  3. getMethod(final Class aClass, final String methodName, Class[] parameterTypes)
  4. getMethod(final Class clazz, final String methodName, final Class... parameterTypes)
  5. getMethod(final Class clazz, final String name, final Class... parametertypes)
  6. getMethod(final Class target, final String name, final Class... parameters)
  7. getMethod(final Class receiver, final String methodName, final Class... parameterTypes)
  8. getMethod(final Field visitee, final String methodName, final Class... parameterTypes)
  9. getMethod(String classFullName, String methodName, Class... parameterTypes)