groovy.lang
Class MetaMethod
java.lang.Object
groovy.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.18 $
- Author:
- James Strachan
MetaMethod
public MetaMethod(String name,
Class declaringClass,
Class[] parameterTypes,
Class returnType,
int modifiers)
MetaMethod
public MetaMethod(Method method)
MetaMethod
public MetaMethod(MetaMethod metaMethod)
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()
- Overrides:
toString
in class Object
clone
public Object clone()
- Overrides:
clone
in class 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 Class getInterfaceClass()
setInterfaceClass
public void setInterfaceClass(Class interfaceClass)
isCacheable
public boolean isCacheable()
Copyright © 2003-2010 The Codehaus. All Rights Reserved.