org.apache.velocity.util.introspection

Class 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 $

Authors:
Jason van Zyl
Bob McWhirter
Christoph Reck
Geir Magnusson Jr.

Field Summary

protected static Object
OBJECT
(package private) Map
methodByNameMap
Keep track of all methods with the same name.

Method Summary

void
add(Method method)
Add a method to a list of methods by name.
private MethodMap.Twonk
calcDistance(Object[] set, Class[] base)
Calculates the distance, expressed as a vector of inheritance steps, between the calling args and the method args.
private boolean
checkPrimitive(Class formal, Class arg)
check for primitive and widening.
Method
find(String methodName, Object[] params)
Find a method.
List
get(String key)
Return a list of methods with the same name.

Field Details

OBJECT

protected static final Object OBJECT


methodByNameMap

(package private)  Map methodByNameMap
Keep track of all methods with the same name.

Method Details

add

public void add(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.


calcDistance

private MethodMap.Twonk calcDistance(Object[] set,
                                     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(Class formal,
                               Class arg)
check for primitive and widening. Take from the 1.4 code


find

public Method find(String methodName,
                   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:

Returns:
Method


get

public List get(String key)
Return a list of methods with the same name.

Parameters:

Returns:
List list of methods


Copyright © 2003 Apache Software Foundation. All Rights Reserved.