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