1 26 27 package org.objectweb.util.explorer.plugin.java.reflect; 28 29 import java.lang.reflect.Method ; 30 31 32 40 public class MethodUtil 41 extends MemberUtil { 42 43 49 50 protected Method method_; 51 52 58 public MethodUtil(Method method){ 59 super(); 60 method_ = method; 61 } 62 63 public MethodUtil(Method method, ClassVisibilityConfig config) { 64 super(config); 65 method_ = method; 66 } 67 68 74 80 83 public String toHTML(){ 84 boolean displayParams = config_.get(ClassVisibilityConfig.METHOD + "." + ClassVisibilityConfig.PARAMS); 85 boolean displayReturnType = config_.get(ClassVisibilityConfig.METHOD + "." + ClassVisibilityConfig.RETURN_TYPE); 86 String visibility = getVisibility(method_.getModifiers()); 87 StringBuffer name = new StringBuffer ((visibility!=null?"<i>"+visibility+"</i>" + " ":"") + "<b>" + method_.getName() + "</b>("); 88 if(displayParams){ 89 Class [] params = method_.getParameterTypes(); 90 for(int j=0 ; j<params.length ; j++) { 91 name.append(ClassVisibility.getTypeName(params[j])); 92 if(j<params.length-1) 93 name.append(", "); 94 } 95 } 96 name.append(")"); 97 if(displayReturnType) 98 name.append(": " + ClassVisibility.getTypeName(method_.getReturnType())); 99 return name.toString(); 100 } 101 102 } 103 104 105 106 | Popular Tags |