groovy.lang
Class MetaClass

java.lang.Object
  extended by groovy.lang.MetaClass
Direct Known Subclasses:
DelegatingMetaClass, MetaClassImpl

public abstract class MetaClass
extends Object

Author:
John Wilson

Field Summary
protected static Logger log
           
protected  List newGroovyMethodsList
           
static Object NO_METHOD_FOUND
           
protected  Class theClass
           
protected static boolean useReflection
           
 
Constructor Summary
protected MetaClass(Class theClass)
           
 
Method Summary
protected abstract  void addNewInstanceMethod(Method method)
           
protected abstract  void addNewStaticMethod(Method method)
           
protected abstract  void checkInitialised()
           
abstract  Object getAttribute(Object object, String attribute)
           
abstract  ClassNode getClassNode()
           
abstract  List getMetaMethods()
           
abstract  List getMethods()
           
abstract  List getProperties()
           
abstract  Object getProperty(Object object, String property)
           
abstract  Object invokeConstructor(Object[] arguments)
           
abstract  Object invokeConstructorAt(Class at, Object[] arguments)
           
 Object invokeMethod(Object object, String methodName, Object arguments)
           
abstract  Object invokeMethod(Object object, String methodName, Object[] arguments)
           
abstract  Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
           
static boolean isUseReflection()
           
protected abstract  MetaMethod pickMethod(Object object, String methodName, Object[] arguments)
           
protected abstract  MetaMethod pickMethod(String methodName, Class[] arguments)
           
abstract  Constructor retrieveConstructor(Class[] arguments)
           
abstract  MetaMethod retrieveMethod(Object owner, String methodName, Object[] arguments)
           
abstract  MetaMethod retrieveMethod(String methodName, Class[] arguments)
           
abstract  MetaMethod retrieveStaticMethod(String methodName, Class[] arguments)
           
abstract  void setAttribute(Object object, String attribute, Object newValue)
           
abstract  void setProperties(Object bean, Map map)
           
abstract  void setProperty(Object object, String property, Object newValue)
           
static void setUseReflection(boolean useReflection)
          Allows reflection to be enabled in situations where bytecode generation of method invocations causes issues.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Logger log

useReflection

protected static boolean useReflection

NO_METHOD_FOUND

public static final Object NO_METHOD_FOUND

theClass

protected final Class theClass

newGroovyMethodsList

protected List newGroovyMethodsList
Constructor Detail

MetaClass

protected MetaClass(Class theClass)
Method Detail

isUseReflection

public static boolean isUseReflection()

setUseReflection

public static void setUseReflection(boolean useReflection)
Allows reflection to be enabled in situations where bytecode generation of method invocations causes issues.

Parameters:
useReflection -

invokeMethod

public Object invokeMethod(Object object,
                           String methodName,
                           Object arguments)

invokeConstructor

public abstract Object invokeConstructor(Object[] arguments)

invokeMethod

public abstract Object invokeMethod(Object object,
                                    String methodName,
                                    Object[] arguments)

invokeStaticMethod

public abstract Object invokeStaticMethod(Object object,
                                          String methodName,
                                          Object[] arguments)

getProperty

public abstract Object getProperty(Object object,
                                   String property)

setProperty

public abstract void setProperty(Object object,
                                 String property,
                                 Object newValue)

getAttribute

public abstract Object getAttribute(Object object,
                                    String attribute)

setAttribute

public abstract void setAttribute(Object object,
                                  String attribute,
                                  Object newValue)

getMethods

public abstract List getMethods()

pickMethod

protected abstract MetaMethod pickMethod(String methodName,
                                         Class[] arguments)

pickMethod

protected abstract MetaMethod pickMethod(Object object,
                                         String methodName,
                                         Object[] arguments)

retrieveMethod

public abstract MetaMethod retrieveMethod(Object owner,
                                          String methodName,
                                          Object[] arguments)

retrieveMethod

public abstract MetaMethod retrieveMethod(String methodName,
                                          Class[] arguments)

retrieveStaticMethod

public abstract MetaMethod retrieveStaticMethod(String methodName,
                                                Class[] arguments)

retrieveConstructor

public abstract Constructor retrieveConstructor(Class[] arguments)

addNewInstanceMethod

protected abstract void addNewInstanceMethod(Method method)

addNewStaticMethod

protected abstract void addNewStaticMethod(Method method)

checkInitialised

protected abstract void checkInitialised()

getProperties

public abstract List getProperties()

setProperties

public abstract void setProperties(Object bean,
                                   Map map)

getClassNode

public abstract ClassNode getClassNode()

getMetaMethods

public abstract List getMetaMethods()

invokeConstructorAt

public abstract Object invokeConstructorAt(Class at,
                                           Object[] arguments)


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