1 16 17 package org.apache.commons.jexl.util.introspection; 18 19 import java.lang.reflect.Method ; 20 21 import org.apache.commons.logging.Log; 22 23 24 53 public class Introspector extends IntrospectorBase { 54 58 59 public static final String CACHEDUMP_MSG = 60 "Introspector : detected classloader change. Dumping cache."; 61 62 65 private final Log rlog; 66 67 71 public Introspector(Log logger) { 72 this.rlog = logger; 73 } 74 75 87 public Method getMethod(Class c, String name, Object [] params) throws Exception { 88 91 92 try { 93 return super.getMethod(c, name, params); 94 } catch (MethodMap.AmbiguousException ae) { 95 98 99 StringBuffer msg = new StringBuffer ("Introspection Error : Ambiguous method invocation ") 100 .append(name).append("( "); 101 102 for (int i = 0; i < params.length; i++) { 103 if (i > 0) { 104 msg.append(", "); 105 } 106 107 msg.append(params[i].getClass().getName()); 108 } 109 110 msg.append(") for class ").append(c.getName()); 111 112 rlog.error(msg.toString()); 113 } 114 115 return null; 116 } 117 118 122 protected void clearCache() { 123 super.clearCache(); 124 rlog.info(CACHEDUMP_MSG); 125 } 126 } 127 | Popular Tags |