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.9 2001/03/05 11:48:49 jvanzyl Exp $
- Author:
- Jason van Zyl, Bob McWhirter
Method Summary |
private static java.lang.reflect.Method |
findMethod(java.lang.Class c,
java.lang.String name,
java.lang.Object[] params)
Find a method in a class. |
static java.lang.reflect.Method |
getMethod(java.lang.Class c,
java.lang.String name,
java.lang.Object[] params)
|
static boolean |
implementsMethod(java.lang.Object object,
java.lang.String methodName)
Checks whether the provided object implements a given method. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
classMethodMaps
private static java.util.Hashtable classMethodMaps
Introspector
public Introspector()
getMethod
public static java.lang.reflect.Method getMethod(java.lang.Class c,
java.lang.String name,
java.lang.Object[] params)
throws java.lang.Exception
findMethod
private static java.lang.reflect.Method findMethod(java.lang.Class c,
java.lang.String name,
java.lang.Object[] params)
- Find a method in a class.
- Parameters:
Class
- class to searchString
- name of methodObject[]
- parameters
implementsMethod
public static boolean implementsMethod(java.lang.Object object,
java.lang.String methodName)
- Checks whether the provided object implements a given method.
- Parameters:
object
- The object to check.methodName
- The method to check for.- Returns:
- Whether the method is implemented.
Copyright © 2001 Apache Software Foundation. All Rights Reserved.