groovy.lang
Class MetaMethod

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

public class MetaMethod
extends Object
implements Cloneable

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

Version:
$Revision: 1.15 $
Author:
James Strachan

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

Constructor Detail

MetaMethod

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

MetaMethod

public MetaMethod(Method method)

MetaMethod

public MetaMethod(MetaMethod metaMethod)
Method Detail

checkParameters

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

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

invoke

public Object invoke(Object object,
                     Object[] arguments)
              throws Exception
Throws:
Exception

getDeclaringClass

public Class getDeclaringClass()

setDeclaringClass

public void setDeclaringClass(Class c)

getMethodIndex

public int getMethodIndex()

setMethodIndex

public void setMethodIndex(int methodIndex)

getModifiers

public int getModifiers()

getName

public String getName()

getParameterTypes

public Class[] getParameterTypes()

getReturnType

public Class getReturnType()

getReflector

public Reflector getReflector()

setReflector

public void setReflector(Reflector reflector)

isMethod

public boolean isMethod(Method method)

equal

protected boolean equal(Class[] a,
                        Class[] b)

toString

public String toString()

clone

public Object clone()

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 Class getInterfaceClass()

setInterfaceClass

public void setInterfaceClass(Class interfaceClass)

isCacheable

public boolean isCacheable()


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