groovy.lang
Class DelegatingMetaClass

java.lang.Object
  extended bygroovy.lang.MetaClass
      extended bygroovy.lang.DelegatingMetaClass

public class DelegatingMetaClass
extends MetaClass

Author:
John Wilson

Field Summary
protected  MetaClass delegate
           
 
Fields inherited from class groovy.lang.MetaClass
log, NO_METHOD_FOUND, theClass, useReflection
 
Constructor Summary
DelegatingMetaClass(Class theClass)
           
DelegatingMetaClass(MetaClass delegate)
           
 
Method Summary
 void addNewInstanceMethod(Method method)
          adds a new instance method to this meta class.
 void addNewStaticMethod(Method method)
          adds a new static method to this meta class.
 boolean equals(Object obj)
           
 Object getAttribute(Object object, String attribute)
           
 ClassNode getClassNode()
           
 List getMetaMethods()
           
 List getMethods()
           
 List getProperties()
           
 Object getProperty(Object object, String property)
           
 int hashCode()
           
 void initialize()
          complete the initlialisation process.
 Object invokeConstructor(Object[] arguments)
           
 Object invokeMethod(Object object, String methodName, Object arguments)
           
 Object invokeMethod(Object object, String methodName, Object[] arguments)
           
 Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
           
 MetaMethod pickMethod(String methodName, Class[] arguments)
          Warning, this method will be removed until 1.0
protected  MetaMethod retrieveMethod(String methodName, Class[] arguments)
          Warning, this method will be removed until 1.0
 void setAttribute(Object object, String attribute, Object newValue)
           
 void setProperty(Object object, String property, Object newValue)
           
 String toString()
           
 
Methods inherited from class groovy.lang.MetaClass
getAttribute, getProperty, invokeConstructorAt, invokeMethod, invokeMissingMethod, isGroovyObject, isUseReflection, setAttribute, setProperty, setUseReflection
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected final MetaClass delegate
Constructor Detail

DelegatingMetaClass

public DelegatingMetaClass(MetaClass delegate)

DelegatingMetaClass

public DelegatingMetaClass(Class theClass)
Method Detail

addNewInstanceMethod

public void addNewInstanceMethod(Method method)
Description copied from class: MetaClass
adds a new instance method to this meta class. Instance methods are able to overwrite the original methods of the class. Calling this method should not be done after initlise was called.

Specified by:
addNewInstanceMethod in class MetaClass
Parameters:
method - the method to be added

addNewStaticMethod

public void addNewStaticMethod(Method method)
Description copied from class: MetaClass
adds a new static method to this meta class. This is only possible as long as initilise was not called.

Specified by:
addNewStaticMethod in class MetaClass
Parameters:
method - the method to be added

initialize

public void initialize()
Description copied from class: MetaClass
complete the initlialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/proeprties is forbidden unless this method is called. This method should contain any initialisation code, taking a longer time to complete. An example is the creation of the Reflector. It is suggested to synchronize this method.

Specified by:
initialize in class MetaClass

getAttribute

public Object getAttribute(Object object,
                           String attribute)
Specified by:
getAttribute in class MetaClass

getClassNode

public ClassNode getClassNode()
Specified by:
getClassNode in class MetaClass

getMetaMethods

public List getMetaMethods()
Specified by:
getMetaMethods in class MetaClass

getMethods

public List getMethods()
Specified by:
getMethods in class MetaClass

getProperties

public List getProperties()
Specified by:
getProperties in class MetaClass

getProperty

public Object getProperty(Object object,
                          String property)
Specified by:
getProperty in class MetaClass

invokeConstructor

public Object invokeConstructor(Object[] arguments)
Specified by:
invokeConstructor in class MetaClass

invokeMethod

public Object invokeMethod(Object object,
                           String methodName,
                           Object arguments)
Overrides:
invokeMethod in class MetaClass

invokeMethod

public Object invokeMethod(Object object,
                           String methodName,
                           Object[] arguments)
Specified by:
invokeMethod in class MetaClass

invokeStaticMethod

public Object invokeStaticMethod(Object object,
                                 String methodName,
                                 Object[] arguments)
Specified by:
invokeStaticMethod in class MetaClass

setAttribute

public void setAttribute(Object object,
                         String attribute,
                         Object newValue)
Specified by:
setAttribute in class MetaClass

setProperty

public void setProperty(Object object,
                        String property,
                        Object newValue)
Specified by:
setProperty in class MetaClass

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

toString

public String toString()

pickMethod

public MetaMethod pickMethod(String methodName,
                             Class[] arguments)
Deprecated.  

Description copied from class: MetaClass
Warning, this method will be removed until 1.0

Specified by:
pickMethod in class MetaClass

retrieveMethod

protected MetaMethod retrieveMethod(String methodName,
                                    Class[] arguments)
Deprecated.  

Description copied from class: MetaClass
Warning, this method will be removed until 1.0

Specified by:
retrieveMethod in class MetaClass


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