Java examples for Reflection:Method
Building a summary for the method signature.
//package com.java2s; import java.lang.reflect.Method; public class Main { /**// w w w . j a v a 2 s. c om * 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) { sb.append(", "); } first = false; sb.append(parameter.getSimpleName()); } sb.append(")"); return sb.toString(); } }