为指定方法指定标准方法名称。
import java.lang.reflect.Method; import java.lang.reflect.Type; import javax.management.openmbean.OpenDataException;// 来 自 nowjava.com - 时 代 Java public class Main{ /** * Make a fully qualified method name for specified method. * * @param method the method. * @return the fully qualified method name. */ public static String makeFullyQualifiedName(final Method method) { final String[] signature = BeanUtil.getSignature(method); return makeFullyQualifiedName(method.getName(), signature); } /** * Make a fully qualified method name from specified parameters. * * @param actionName the name of method. * @param signature the types of each parameter. * @return the fully qualified method name. */ public static String makeFullyQualifiedName(final String actionName, final String[] signature) { final StringBuilder sb = new StringBuilder(); sb.append(actionName); sb.append('('); if (null != signature) { for (int i = 0; i < signature.length; i++) { if (i != 0) {//时 代 Java 公 众 号 - nowjava.com 提 供 sb.append(','); } sb.append(signature[i]); } } sb.append(')'); return sb.toString(); } /** * Return the signature of method as an array of strings. * * @param method the method. * @return the signature. */ public static String[] getSignature(final Method method) {