Class TransformMetaMethod

java.lang.Object
org.codehaus.groovy.reflection.ParameterTypes
groovy.lang.MetaMethod
org.codehaus.groovy.runtime.metaclass.TransformMetaMethod
All Implemented Interfaces:
MetaMember, Cloneable

public class TransformMetaMethod extends MetaMethod
A MetaMethod implementation useful for implementing coercion based invocations. This method wraps another metamethod and allows for argument transformation or other custom handling during method invocation.
  • Constructor Details

    • TransformMetaMethod

      public TransformMetaMethod(MetaMethod metaMethod)
      Constructs a new TransformMetaMethod.
      Parameters:
      metaMethod - the metamethod to wrap
  • Method Details

    • getModifiers

      public int getModifiers()
      Returns the modifiers of the wrapped metamethod.
      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 metamethod.
      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 metamethod.
      Specified by:
      getReturnType in class MetaMethod
      Returns:
      the return type
    • getDeclaringClass

      public CachedClass getDeclaringClass()
      Returns the class that declares the wrapped metamethod.
      Specified by:
      getDeclaringClass in class MetaMethod
      Returns:
      the declaring class
    • invoke

      public Object invoke(Object object, Object[] arguments)
      Invokes the wrapped metamethod 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
    • doMethodInvoke

      public Object doMethodInvoke(Object object, Object[] arguments)
      Invokes the wrapped metamethod without argument coercion. This method skips the default argument coercion performed by the parent invoke method.
      Overrides:
      doMethodInvoke in class MetaMethod
      Parameters:
      object - the object to invoke the method on
      arguments - the method arguments
      Returns:
      the method return value