org.apache.velocity.util.introspection
Class Introspector

java.lang.Object
  |
  +--org.apache.velocity.util.introspection.Introspector

public class Introspector
extends java.lang.Object

This basic function of this class is to return a Method object for a particular class given the name of a method and the parameters to the method in the form of an Object[] The first time the Introspector sees a class it creates a class method map for the class in question. Basically the class method map is a Hastable where Method objects are keyed by a concatenation of the method name and the names of classes that make up the parameters. For example, a method with the following signature: public void method(String a, StringBuffer b) would be mapped by the key: "method" + "java.lang.String" + "java.lang.StringBuffer" This mapping is performed for all the methods in a class and stored for

Version:
$Id: Introspector.java,v 1.16 2001/09/26 11:19:04 geirm Exp $
Author:
Jason van Zyl, Bob McWhirter, Attila Szegedi, Paulo Gaspar

Field Summary
private  java.util.Set cachedClassNames
          Holds the qualified class names for the classes we hold in the classMethodMaps hash
static java.lang.String CACHEDUMP_MSG
           
private  java.util.Map classMethodMaps
          Holds the method maps for the classes we know about, keyed by Class object.
private  RuntimeServices rsvc
           
 
Constructor Summary
Introspector(RuntimeServices r)
          Recieves our RuntimeServices object
 
Method Summary
private  void clearCache()
          Clears the classmap and classname caches
private  ClassMap createClassMap(java.lang.Class c)
          Creates a class map for specific class and registers it in the cache.
 java.lang.reflect.Method getMethod(java.lang.Class c, java.lang.String name, java.lang.Object[] params)
          Gets the method defined by name and params for the Class c.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

CACHEDUMP_MSG

public static final java.lang.String CACHEDUMP_MSG

rsvc

private RuntimeServices rsvc

classMethodMaps

private final java.util.Map classMethodMaps
Holds the method maps for the classes we know about, keyed by Class object.

cachedClassNames

private java.util.Set cachedClassNames
Holds the qualified class names for the classes we hold in the classMethodMaps hash
Constructor Detail

Introspector

public Introspector(RuntimeServices r)
Recieves our RuntimeServices object
Method Detail

getMethod

public java.lang.reflect.Method getMethod(java.lang.Class c,
                                          java.lang.String name,
                                          java.lang.Object[] params)
                                   throws java.lang.Exception
Gets the method defined by name and params for the Class c.
Returns:
The desired Method object.

createClassMap

private ClassMap createClassMap(java.lang.Class c)
Creates a class map for specific class and registers it in the cache. Also adds the qualified name to the name->class map for later Classloader change detection.

clearCache

private void clearCache()
Clears the classmap and classname caches


Copyright © 2001 Apache Software Foundation. All Rights Reserved.