groovy.lang
Class MetaMethod

java.lang.Object
  extended bygroovy.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: 1.14 $
Author:
James Strachan

Field Summary
private  java.lang.Class declaringClass
           
private  java.lang.Class interfaceClass
           
private static java.util.logging.Logger log
           
private  java.lang.reflect.Method method
           
private  int methodIndex
           
private  int modifiers
           
private  java.lang.String name
           
private  java.lang.Class[] parameterTypes
           
private  Reflector reflector
           
private  java.lang.Class returnType
           
 
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 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 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
 

Field Detail

log

private static final java.util.logging.Logger log

name

private java.lang.String name

declaringClass

private java.lang.Class declaringClass

interfaceClass

private java.lang.Class interfaceClass

parameterTypes

private java.lang.Class[] parameterTypes

returnType

private java.lang.Class returnType

modifiers

private int modifiers

reflector

private Reflector reflector

methodIndex

private int methodIndex

method

private java.lang.reflect.Method method
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)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getDeclaringClass

public java.lang.Class getDeclaringClass()

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

clone

public java.lang.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 java.lang.Class getInterfaceClass()

setInterfaceClass

public void setInterfaceClass(java.lang.Class interfaceClass)

isCacheable

public boolean isCacheable()


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