Java Reflection Method Parameter getMethodFullName(Method m, boolean includeClassPackage, boolean includeParametersType, boolean includeTypesPackage)

Here you can find the source of getMethodFullName(Method m, boolean includeClassPackage, boolean includeParametersType, boolean includeTypesPackage)

Description

get Method Full Name

License

Apache License

Declaration

public static String getMethodFullName(Method m, boolean includeClassPackage, boolean includeParametersType,
            boolean includeTypesPackage) 

Method Source Code


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

import java.lang.reflect.Method;

public class Main {
    public static String getMethodFullName(Method m, boolean includeClassPackage, boolean includeParametersType,
            boolean includeTypesPackage) {
        String str;// w ww. j  a  v a2  s .c o m
        str = includeClassPackage ? m.getClass().getName() : m.getClass().getSimpleName() + "." + m.getName() + "(";
        if (!(m.getParameterTypes().length == 0) && includeParametersType) {
            for (int i = 0; i < m.getParameterTypes().length; i++) {
                str = str + (includeTypesPackage ? m.getParameterTypes()[i].getName()
                        : m.getParameterTypes()[i].getSimpleName());
                if (!(i == m.getParameterTypes().length - 1))
                    str = str + ", ";
            }
        }
        str = str + ")";
        return str;
    }
}

Related

  1. getMethodAnnotations(String className, String methodName, Class[] parameterTypes)
  2. getMethodByName(Class clazz, String name, Class... parameterTypes)
  3. getMethodByParametersWithAnnotation(final Class source, final Class[] params, final Class annotation)
  4. getMethodFromClass(String className, String methodName, Class... parameterTypes)
  5. getMethodFromClassName(String classAndMethodName, Class... parameterTypes)
  6. getMethodGenericParameterTypes(Method method, int index)
  7. getMethodHandle(final Lookup lookup, final Class receiver, final String methodName, final Class... parameterTypes)
  8. getMethodName(Method method, Class[] parameterClasses, String rightCode)
  9. getMethodParameterAnnotations(Method method, int index, Class annotationClass)