org.apache.tapestry5.ioc.internal.services

## Class MethodSignature

- java.lang.Object
- - org.apache.tapestry5.ioc.internal.services.MethodSignature

-     public class MethodSignature
      extends Object

  A representation of a `Method`, identifying the name, return type, parameter types and exception types. Actual Method objects are tied to a particular class, and don't compare well with other otherwise identical Methods from other classes or interface; MethodSignatures are distinct from classes and compare well. Because the intended purpose is to compare methods from interfaces (which are always public and abstract) we don't bother to actually track the modifiers. In addition, at this time, MethodSignature does not distinguish between instance and static methods.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodSignature(Class returnType, String name, Class[] parameterTypes, Class[] exceptionTypes)`
    `MethodSignature(Method m)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Returns true if the other object is an instance of MethodSignature with identical values for return type, name, parameter types and exception types.
    `Class[]` | `getExceptionTypes()` Returns the exceptions for this method.
    `Method` | `getMethod()` If this signature was created from a method, return that method.
    `String` | `getName()`
    `Class[]` | `getParameterTypes()` Returns the parameter types for this method.
    `Class` | `getReturnType()`
    `String` | `getUniqueId()` Returns a string consisting of the name of the method and its parameter types.
    `int` | `hashCode()`
    `boolean` | `isOverridingSignatureOf(MethodSignature ms)` Returns true if this signature has the same return type, name and parameters types as the method signature passed in, and this signature's exceptions "trump" (are the same as, or super-implementations of, all exceptions thrown by the other method signature).
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MethodSignature

          public MethodSignature(Class returnType,
                                 String name,
                                 Class[] parameterTypes,
                                 Class[] exceptionTypes)

    - #### MethodSignature

          public MethodSignature(Method m)

  - ### Method Detail

    - #### getExceptionTypes

          public Class[] getExceptionTypes()

      Returns the exceptions for this method. Caution: do not modify the returned array. May return null.

    - #### getName

          public String getName()

    - #### getMethod

          public Method getMethod()

      If this signature was created from a method, return that method.
      Since:
        5.3

    - #### getParameterTypes

          public Class[] getParameterTypes()

      Returns the parameter types for this method. May return null. Caution: do not modify the returned array.

    - #### getReturnType

          public Class getReturnType()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Returns true if the other object is an instance of MethodSignature with identical values for return type, name, parameter types and exception types.
      Overrides:
        `equals` in class `Object`
      See Also:
        `isOverridingSignatureOf(MethodSignature)`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getUniqueId

          public String getUniqueId()

      Returns a string consisting of the name of the method and its parameter types. This is similar to `toString()`, but omits the return type and information about thrown exceptions. A unique id is used by `MethodIterator` to identify overlapping methods (methods with the same name and parameter types but with different thrown exceptions).
      See Also:
        `isOverridingSignatureOf(MethodSignature)`

    - #### isOverridingSignatureOf

          public boolean isOverridingSignatureOf(MethodSignature ms)

      Returns true if this signature has the same return type, name and parameters types as the method signature passed in, and this signature's exceptions "trump" (are the same as, or super-implementations of, all exceptions thrown by the other method signature).

5.6.0 - Copyright © 2003-2020 The Apache Software Foundation.