geirm 01/05/14 12:44:18
Modified: src/java/org/apache/velocity/util/introspection
ClassMap.java
Log:
Backing out for now until 1.1 is tagged (and this is fixed).
Revision Changes Path
1.10 +4 -70
jakarta-velocity/src/java/org/apache/velocity/util/introspection/ClassMap.java
Index: ClassMap.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/introspection/ClassMap.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ClassMap.java 2001/05/14 04:43:36 1.9
+++ ClassMap.java 2001/05/14 19:44:08 1.10
@@ -65,8 +65,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bob McWhirter</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ClassMap.java,v 1.9 2001/05/14 04:43:36 geirm Exp $
+ * @version $Id: ClassMap.java,v 1.10 2001/05/14 19:44:08 geirm Exp $
*/
// TODO: public boolean (String[] list)
@@ -151,84 +150,19 @@
/**
* Populate the Map of direct hits. These
* are taken from all the public methods
- * of all the public classes / interfaces
* that our class provides.
*/
private void populateMethodCache()
{
- /*
- * start with the interfaces
- */
+ Method[] methods = clazz.getMethods();
+ StringBuffer methodKey;
- Class[] classes = clazz.getInterfaces();
-
- for (int j = 0; j < classes.length; j++)
- {
- /*
- * if the class is public, then add it to the cache
- */
-
- if (Modifier.isPublic( classes[j].getModifiers()))
- {
- populateMethodCache( classes[j] );
- }
- }
-
- /*
- * and now the classes
- */
-
- classes = clazz.getClasses();
-
- for (int j = 0; j < classes.length; j++)
- {
- /*
- * if the class is public, then add it to the cache
- */
-
- if (Modifier.isPublic( classes[j].getModifiers()))
- {
- populateMethodCache( classes[j] );
- }
- }
- }
-
- /**
- * adds all public methods to the method cache
- * and map
- * @param claz Class to analyze
- */
- private void populateMethodCache( Class claz )
- {
- /*
- * now, get all methods, from both interfaces
- * as well as super
- */
-
- Method[] methods = claz.getMethods();
- String methodKey = null;
-
for (int i = 0; i < methods.length; i++)
{
- /*
- * only care if the method is public
- */
-
if (Modifier.isPublic(methods[i].getModifiers()))
{
- methodKey = makeMethodKey( methods[i] );
-
- /*
- * Only add this if we don't already have it, because the method
- * key doesn't distinguish for which class/interface it
- * belongs FOR THIS CLASS. And it shouldn't matter.
- */
-
- if( methodCache.get( methodKey ) == null)
- {
- methodMap.add( methods[i] );
- methodCache.put( methodKey, methods[i]);
- }
+ methodMap.add(methods[i]);
+ methodCache.put(makeMethodKey(methods[i]), methods[i]);
}
}
}