org.apache.velocity.util.introspection
Class MethodMap
java.lang.Object
|
+--org.apache.velocity.util.introspection.MethodMap
- public class MethodMap
- extends java.lang.Object
- Version:
- $Id: MethodMap.java,v 1.13.2.3 2002/07/25 01:35:04 geirm Exp $
- Author:
- Jason van Zyl, Bob McWhirter, Christoph Reck, Geir Magnusson Jr.
Inner Class Summary |
class |
MethodMap.AmbiguousException
simple distinguishable exception, used when
we run across ambiguous overloading |
private class |
MethodMap.Twonk
little class to hold 'distance' information
for calling params, as well as determine
specificity |
Field Summary |
(package private) java.util.Map |
methodByNameMap
Keep track of all methods with the same name. |
protected static java.lang.Object |
OBJECT
|
Method Summary |
void |
add(java.lang.reflect.Method method)
Add a method to a list of methods by name. |
private MethodMap.Twonk |
calcDistance(java.lang.Object[] set,
java.lang.Class[] base)
Calculates the distance, expressed as a vector of inheritance
steps, between the calling args and the method args. |
private boolean |
checkPrimitive(java.lang.Class formal,
java.lang.Class arg)
check for primitive and widening. |
java.lang.reflect.Method |
find(java.lang.String methodName,
java.lang.Object[] params)
Find a method. |
java.util.List |
get(java.lang.String key)
Return a list of methods with the same name. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
OBJECT
protected static final java.lang.Object OBJECT
methodByNameMap
java.util.Map methodByNameMap
- Keep track of all methods with the same name.
MethodMap
public MethodMap()
add
public void add(java.lang.reflect.Method method)
- Add a method to a list of methods by name.
For a particular class we are keeping track
of all the methods with the same name.
get
public java.util.List get(java.lang.String key)
- Return a list of methods with the same name.
- Parameters:
String
- key- Returns:
- List list of methods
find
public java.lang.reflect.Method find(java.lang.String methodName,
java.lang.Object[] params)
throws MethodMap.AmbiguousException
Find a method. Attempts to find the
most appropriate method using the
sense of 'specificity'.
This turns out to be a relatively rare case
where this is needed - however, functionality
like this is needed. This may not be the
optimum approach, but it works.
- Parameters:
String
- name of methodObject[]
- params- Returns:
- Method
calcDistance
private MethodMap.Twonk calcDistance(java.lang.Object[] set,
java.lang.Class[] base)
- Calculates the distance, expressed as a vector of inheritance
steps, between the calling args and the method args.
There still is an issue re interfaces...
checkPrimitive
private boolean checkPrimitive(java.lang.Class formal,
java.lang.Class arg)
- check for primitive and widening. Take from the 1.4 code
Copyright © 2003 Apache Software Foundation. All Rights Reserved.