1 package org.apache.velocity.util.introspection; 2 3 18 19 import java.util.Map ; 20 import java.util.Set ; 21 import java.util.HashMap ; 22 import java.util.HashSet ; 23 24 import java.lang.reflect.Method ; 25 26 import org.apache.velocity.runtime.RuntimeServices; 27 import org.apache.velocity.runtime.RuntimeLogger; 28 29 57 public class Introspector extends IntrospectorBase 58 { 59 63 64 public final static String CACHEDUMP_MSG = 65 "Introspector : detected classloader change. Dumping cache."; 66 67 70 private RuntimeLogger rlog = null; 71 72 75 public Introspector(RuntimeLogger logger) 76 { 77 this.rlog = logger; 78 } 79 80 91 public Method getMethod(Class c, String name, Object [] params) 92 throws Exception 93 { 94 97 98 try 99 { 100 return super.getMethod( c, name, params ); 101 } 102 catch( MethodMap.AmbiguousException ae ) 103 { 104 107 108 String msg = "Introspection Error : Ambiguous method invocation " 109 + name + "( "; 110 111 for (int i = 0; i < params.length; i++) 112 { 113 if ( i > 0) 114 msg = msg + ", "; 115 116 msg = msg + params[i].getClass().getName(); 117 } 118 119 msg = msg + ") for class " + c; 120 121 rlog.error( msg ); 122 } 123 124 return null; 125 } 126 127 131 protected void clearCache() 132 { 133 super.clearCache(); 134 rlog.info( CACHEDUMP_MSG ); 135 } 136 } 137 | Popular Tags |