构建方法签名的摘要。
//package com.nowjava; /** 时代Java - N o w J a v a . c o m 提 供 **/ import java.lang.reflect.Method; public class Main { /** * Building a summary for the method signature. * * @param method * * @return */ public static String buildIdentifier(final Method method) { StringBuilder sb = new StringBuilder(); sb.append(method.getReturnType().getSimpleName()); sb.append(" "); sb.append(method.getName()); sb.append("("); boolean first = true; for (Class parameter : method.getParameterTypes()) { if (!first) { /**来自 N o w J a v a . c o m**/ sb.append(", "); }