MetaMethod (Groovy 5.0.0)

Package: groovy.lang

## [Java] Class MetaMethod

- groovy.lang.MetaMethod

- All Implemented Interfaces and Traits:
    MetaMember, Cloneable

      public abstract class MetaMethod
      extends ParameterTypes
      implements MetaMember, Cloneable

  Represents a Method on a Java object a little like Method except without using reflection to invoke the method

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static MetaMethod[]` | `EMPTY_ARRAY` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `MetaMethod()` Constructor for a metamethod with an empty parameter list.
    `MetaMethod(Class[] pt)` Constructor with a list of parameter classes.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `checkParameters(Class[] arguments)` Checks that the given parameters are valid to call this method.
    `` | `public Object` | `clone()`
    `` | `public Object` | `doMethodInvoke(Object object, Object[] arguments)` Invokes the method this object represents.
    `` | `protected static boolean` | `equal(CachedClass[] a, Class[] b)`
    `` | `protected static boolean` | `equal(CachedClass[] a, CachedClass[] b)`
    `` | `public abstract CachedClass` | `getDeclaringClass()` Gets the class where this method is declared.
    `` | `public String` | `getDescriptor()` Returns a descriptor of this method based on the return type and parameters of this method.
    `` | `public abstract int` | `getModifiers()` Returns the modifiers of this method.
    `` | `public String` | `getMopName()`
    `` | `public abstract String` | `getName()` Returns the name of this method.
    `` | `public abstract Class` | `getReturnType()` Returns the return type for this method.
    `` | `public String` | `getSignature()` Returns the signature of this method.
    `` | `public abstract Object` | `invoke(Object object, Object[] arguments)` Invokes this method.
    `` | `public boolean` | `isAbstract()` Returns whether this method is abstract.
    `` | `public boolean` | `isCacheable()` Returns whether this object is cacheable.
    `` | `public boolean` | `isDefault()` Returns whether this method is interface-default.
    `` | `public boolean` | `isMethod(MetaMethod method)` Returns true if this metamethod represents the same method as the argument.
    `` | `public final boolean` | `isSame(MetaMethod method)` Determines if the given method has the same name, parameters, return type and modifiers but may be defined on another type.
    `` | `public final RuntimeException` | `processDoMethodInvokeException(Exception e, Object object, Object[] arguments)` Called when an exception occurs while invoking this method.
    `` | `public String` | `toString()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ParameterTypes` | `coerceArgumentsToClasses, correctArguments, getNativeParameterTypes, getPT, getParameterTypes, isValidExactMethod, isValidExactMethod, isValidMethod, isValidMethod, isVargsMethod, isVargsMethod, setParametersTypes`

- - ### Field Detail

    - #### public static final MetaMethod[] EMPTY_ARRAY

  - ### Constructor Detail

    - #### public MetaMethod()

      Constructor for a metamethod with an empty parameter list.

    - #### public MetaMethod(Class[] pt)

      Constructor with a list of parameter classes.

      Parameters:
        `pt` - A list of parameters types

  - ### Method Detail

    - #### @Deprecated
      public void checkParameters(Class[] arguments)

      Checks that the given parameters are valid to call this method.

      throws:
        IllegalArgumentException if the parameters are not valid
      deprecated:
      Parameters:
        `arguments` - the arguments to check

    - #### @Override
      public Object clone()

    - #### public Object doMethodInvoke(Object object, Object[] arguments)

      Invokes the method this object represents.

      This method is not final but it should be overloaded very carefully and only by generated methods there is no guarantee that it will be called.

      Parameters:
        `object` - The object the method is to be called at.
        `arguments` - Arguments for the method invocation.
      Returns:
        The return value of the invoked method.

    - #### protected static boolean equal(CachedClass[] a, Class[] b)

    - #### protected static boolean equal(CachedClass[] a, CachedClass[] b)

    - #### public abstract CachedClass getDeclaringClass()

      Gets the class where this method is declared.

      Returns:
        class of this method

    - #### public String getDescriptor()

      Returns a descriptor of this method based on the return type and parameters of this method.

    - #### public abstract int getModifiers()

      Returns the modifiers of this method.

      Returns:
        modifiers as an int.

    - #### public String getMopName()

    - #### public abstract String getName()

      Returns the name of this method.

      Returns:
        name of this method

    - #### public abstract Class getReturnType()

      Returns the return type for this method.

      Returns:
        the return type of this method

    - #### public String getSignature()

      Returns the signature of this method.

      Returns:
        The signature of this method

    - #### public abstract Object invoke(Object object, Object[] arguments)

      Invokes this method.

      Parameters:
        `object` - The object this method should be invoked on
        `arguments` - The arguments for the method if applicable
      Returns:
        The return value of the invocation

    - #### public boolean isAbstract()

      Returns whether this method is abstract.

      Returns:
        true if this method is abstract

    - #### public boolean isCacheable()

      Returns whether this object is cacheable.

    - #### public boolean isDefault()

      Returns whether this method is interface-default.

      Returns:
        true if this method is default

    - #### public boolean isMethod(MetaMethod method)

      Returns true if this metamethod represents the same method as the argument.

      Parameters:
        `method` - A metaMethod instance
      Returns:
        true if method is for the same method as this method, false otherwise.

    - #### public final boolean isSame(MetaMethod method)

      Determines if the given method has the same name, parameters, return type and modifiers but may be defined on another type.

      Parameters:
        `method` - the method to compare against

    - #### public final RuntimeException processDoMethodInvokeException(Exception e, Object object, Object[] arguments)

      Called when an exception occurs while invoking this method.

    - #### @Override
      public String toString()