Here you can find the source of getMethodSignature(Method method)
public static String getMethodSignature(Method method)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Main { private static final Map<Method, List<Class<?>>> parameterTypeCache = new ConcurrentHashMap<>(); public static String getMethodSignature(Method method) { StringBuilder sb = new StringBuilder(); if (method.getReturnType() != null) { sb.append(method.getReturnType().getName()).append("#"); }//from ww w.j a v a 2s .c o m sb.append(method.getName()); Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes != null) { for (int i = 0, length = parameterTypes.length; i < length; i++) { if (i == 0) { sb.append(":"); } else { sb.append(","); } sb.append(parameterTypes[i].getName()); } } return sb.toString(); } /** * @param method * @return {@code List<Class<?>>} */ public static List<Class<?>> getParameterTypes(Method method) { if (parameterTypeCache.containsKey(method)) { return parameterTypeCache.get(method); } List<Class<?>> types = Arrays.asList(method.getParameterTypes()); parameterTypeCache.put(method, types); return types; } }