org.codehaus.plexus.util.introspection

## Class MethodMap

- java.lang.Object
- - org.codehaus.plexus.util.introspection.MethodMap

-     public class MethodMap
      extends Object

  Version:
    $Id$
  Author:
    Jason van Zyl, Bob McWhirter, Christoph Reck, Geir Magnusson Jr., Attila Szegedi

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MethodMap.AmbiguousException` simple distinguishable exception, used when we run across ambiguous overloading

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodMap()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Method method)` Add a method to a list of methods by name.
    `Method` | `find(String methodName, Object[] args)` Find a method.
    `List<Method>` | `get(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, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MethodMap

          public MethodMap()

  - ### Method Detail

    - #### 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.
      Parameters:
        `method` - The method

    - #### get

          public List<Method> get(String key)

      Return a list of methods with the same name.
      Parameters:
        `key` - The name of the method.
      Returns:
        List list of methods

    - #### find

          public Method find(String methodName,
                    Object[] args)
                      throws MethodMap.AmbiguousException

      Find a method. Attempts to find the most specific applicable method using the algorithm described in the JLS section 15.12.2 (with the exception that it can't distinguish a primitive type argument from an object type argument, since in reflection primitive type arguments are represented by their object counterparts, so for an argument of type (say) java.lang.Integer, it will not be able to decide between a method that takes int and a method that takes java.lang.Integer as a parameter.

      This turns out to be a relatively rare case where this is needed - however, functionality like this is needed.

      Parameters:
        `methodName` - name of method
        `args` - the actual arguments with which the method is called
      Returns:
        the most specific applicable method, or null if no method is applicable.
      Throws:
        `MethodMap.AmbiguousException` - if there is more than one maximally specific applicable method

Copyright © 2015. All rights reserved.