groovy.lang
Class MetaMethod

java.lang.Object
  extended by groovy.lang.MetaMethod
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
NewInstanceMetaMethod, NewStaticMetaMethod, ReflectionMetaMethod, TransformMetaMethod

public class MetaMethod
extends java.lang.Object
implements java.lang.Cloneable

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

Version:
$Revision: 4254 $
Author:
James Strachan

Constructor Summary
MetaMethod(MetaMethod metaMethod)
           
MetaMethod(java.lang.reflect.Method method)
           
MetaMethod(java.lang.String name, java.lang.Class declaringClass, java.lang.Class[] parameterTypes, java.lang.Class returnType, int modifiers)
           
 
Method Summary
 void checkParameters(java.lang.Class[] arguments)
          Checks that the given parameters are valid to call this method
 java.lang.Object clone()
           
protected  boolean compatibleModifiers(int modifiersA, int modifiersB)
           
protected  boolean equal(java.lang.Class[] a, java.lang.Class[] b)
           
 java.lang.Class getCallClass()
           
 java.lang.Class getDeclaringClass()
           
 java.lang.Class getInterfaceClass()
           
 int getMethodIndex()
           
 int getModifiers()
           
 java.lang.String getName()
           
 java.lang.Class[] getParameterTypes()
           
 Reflector getReflector()
           
 java.lang.Class getReturnType()
           
 java.lang.Object invoke(java.lang.Object object, java.lang.Object[] arguments)
           
 boolean isCacheable()
           
 boolean isMethod(java.lang.reflect.Method method)
           
 boolean isPrivate()
           
 boolean isProtected()
           
 boolean isPublic()
           
 boolean isSame(MetaMethod method)
           
 boolean isStatic()
           
 void setCallClass(java.lang.Class c)
           
 void setInterfaceClass(java.lang.Class interfaceClass)
           
 void setMethodIndex(int methodIndex)
           
 void setReflector(Reflector reflector)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaMethod

public MetaMethod(java.lang.String name,
                  java.lang.Class declaringClass,
                  java.lang.Class[] parameterTypes,
                  java.lang.Class returnType,
                  int modifiers)

MetaMethod

public MetaMethod(java.lang.reflect.Method method)

MetaMethod

public MetaMethod(MetaMethod metaMethod)
Method Detail

checkParameters

public void checkParameters(java.lang.Class[] arguments)
Checks that the given parameters are valid to call this method

Parameters:
arguments -
Throws:
java.lang.IllegalArgumentException - if the parameters are not valid

invoke

public java.lang.Object invoke(java.lang.Object object,
                               java.lang.Object[] arguments)

getCallClass

public java.lang.Class getCallClass()

setCallClass

public void setCallClass(java.lang.Class c)

getMethodIndex

public int getMethodIndex()

setMethodIndex

public void setMethodIndex(int methodIndex)

getModifiers

public int getModifiers()

getName

public java.lang.String getName()

getParameterTypes

public java.lang.Class[] getParameterTypes()

getReturnType

public java.lang.Class getReturnType()

getReflector

public Reflector getReflector()

setReflector

public void setReflector(Reflector reflector)

isMethod

public boolean isMethod(java.lang.reflect.Method method)

equal

protected boolean equal(java.lang.Class[] a,
                        java.lang.Class[] b)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

isStatic

public boolean isStatic()

isPrivate

public boolean isPrivate()

isProtected

public boolean isProtected()

isPublic

public boolean isPublic()

isSame

public boolean isSame(MetaMethod method)
Returns:
true if the given method has the same name, parameters, return type and modifiers but may be defined on another type

compatibleModifiers

protected boolean compatibleModifiers(int modifiersA,
                                      int modifiersB)

getInterfaceClass

public java.lang.Class getInterfaceClass()

setInterfaceClass

public void setInterfaceClass(java.lang.Class interfaceClass)

isCacheable

public boolean isCacheable()

getDeclaringClass

public java.lang.Class getDeclaringClass()


Copyright © 2003-2011 The Codehaus. All Rights Reserved.