Package org.codehaus.groovy.runtime.metaclass

# Class ReflectionMetaMethod

java.lang.Object
org.codehaus.groovy.reflection.ParameterTypes
groovy.lang.MetaMethod
org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod

All Implemented Interfaces:
  `MetaMember`, `Cloneable`

Direct Known Subclasses:
  `NewMetaMethod`

public class ReflectionMetaMethod extends MetaMethod
A MetaMethod implementation that wraps a reflection-based method call. This class provides access to a cached method and delegates method invocations to the underlying cached method.

This implementation is for internal use by the Groovy runtime.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final CachedMethod`
  `method`
  The underlying cached method that this MetaMethod wraps

  ### Fields inherited from class groovy.lang.MetaMethod

  `EMPTY_ARRAY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReflectionMetaMethod(CachedMethod method)`
  Constructs a new ReflectionMetaMethod.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MetaMethod`
  `getCachedMethod()`
  Returns the cached method wrapped by this MetaMethod.
  `CachedClass`
  `getDeclaringClass()`
  Returns the class that declares the wrapped cached method.
  `int`
  `getModifiers()`
  Returns the modifiers of the wrapped cached method.
  `String`
  `getName()`
  Returns the name of the wrapped cached method.
  `protected Class[]`
  `getPT()`
  Protected method subclasses override to provide parameter types.
  `Class`
  `getReturnType()`
  Returns the return type of the wrapped cached method.
  `Object`
  `invoke(Object object, Object[] arguments)`
  Invokes the wrapped cached method on the given object with the specified arguments.
  `String`
  `toString()`
  Returns a string representation of the wrapped cached method.

  ### Methods inherited from class groovy.lang.MetaMethod

  `checkParameters, clone, doMethodInvoke, equal, equal, getDescriptor, getMopName, getSignature, isAbstract, isCacheable, isDefault, isMethod, isSame, processDoMethodInvokeException`

  ### Methods inherited from class org.codehaus.groovy.reflection.ParameterTypes

  `coerceArgumentsToClasses, correctArguments, getNativeParameterTypes, getParameterTypes, isValidExactMethod, isValidExactMethod, isValidMethod, isValidMethod, isVargsMethod, isVargsMethod, setParametersTypes`

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

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface groovy.lang.MetaMember

  `isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic`

- ## Field Details

  - ### method

    protected final CachedMethod method
    The underlying cached method that this MetaMethod wraps

- ## Constructor Details

  - ### ReflectionMetaMethod

    public ReflectionMetaMethod(CachedMethod method)
    Constructs a new ReflectionMetaMethod.
    Parameters:
      `method` - the cached method to wrap

- ## Method Details

  - ### getModifiers

    public int getModifiers()
    Returns the modifiers of the wrapped cached method.
    Specified by:
      `getModifiers` in interface `MetaMember`
    Specified by:
      `getModifiers` in class `MetaMethod`
    Returns:
      the method modifiers

  - ### getName

    public String getName()
    Returns the name of the wrapped cached method.
    Specified by:
      `getName` in interface `MetaMember`
    Specified by:
      `getName` in class `MetaMethod`
    Returns:
      the method name

  - ### getReturnType

    public Class getReturnType()
    Returns the return type of the wrapped cached method.
    Specified by:
      `getReturnType` in class `MetaMethod`
    Returns:
      the return type

  - ### getDeclaringClass

    public CachedClass getDeclaringClass()
    Returns the class that declares the wrapped cached method.
    Specified by:
      `getDeclaringClass` in class `MetaMethod`
    Returns:
      the declaring class

  - ### invoke

    public Object invoke(Object object, Object[] arguments)
    Invokes the wrapped cached method on the given object with the specified arguments.
    Specified by:
      `invoke` in class `MetaMethod`
    Parameters:
      `object` - the object to invoke the method on
      `arguments` - the method arguments
    Returns:
      the method return value

  - ### toString

    public String toString()
    Returns a string representation of the wrapped cached method.
    Overrides:
      `toString` in class `MetaMethod`
    Returns:
      the string representation

  - ### getPT

    protected Class[] getPT()
    Description copied from class: `ParameterTypes`
    Protected method subclasses override to provide parameter types. Default implementation throws `UnsupportedOperationException`.
    Overrides:
      `getPT` in class `ParameterTypes`
    Returns:
      the native parameter class array

  - ### getCachedMethod

    public MetaMethod getCachedMethod()
    Returns the cached method wrapped by this MetaMethod.
    Returns:
      the cached method