Package org.codehaus.groovy.runtime
Class HandleMetaClass
java.lang.Object
groovy.lang.DelegatingMetaClass
org.codehaus.groovy.runtime.HandleMetaClass
- All Implemented Interfaces:
GroovyObject
,MetaClass
,MetaObjectProtocol
,MutableMetaClass
public class HandleMetaClass extends DelegatingMetaClass
-
Field Summary
Fields inherited from class groovy.lang.DelegatingMetaClass
delegate
-
Constructor Summary
Constructors Constructor Description HandleMetaClass(MetaClass mc)
HandleMetaClass(MetaClass mc, java.lang.Object obj)
-
Method Summary
Modifier and Type Method Description void
addMetaBeanProperty(MetaBeanProperty metaBeanProperty)
Adds a new MetaBeanProperty to the MetaClassvoid
addMetaMethod(MetaMethod metaMethod)
Adds a new MetaMethod to the MetaClassvoid
addNewInstanceMethod(java.lang.reflect.Method method)
adds a new instance method to this MetaClass.void
addNewStaticMethod(java.lang.reflect.Method method)
adds a new static method to this MetaClass.boolean
equals(java.lang.Object obj)
java.lang.Object
getProperty(java.lang.String property)
Retrieves a property value.void
initialize()
Complete the initialisation process.java.lang.Object
invokeMethod(java.lang.String name, java.lang.Object args)
Invokes the given method.GroovyObject
replaceDelegate()
void
setProperty(java.lang.String property, java.lang.Object newValue)
Sets the given property to the new value.Methods inherited from class groovy.lang.DelegatingMetaClass
getAdaptee, getAttribute, getAttribute, getClassNode, getMetaClass, getMetaMethod, getMetaMethods, getMetaProperty, getMethods, getProperties, getProperty, getProperty, getStaticMetaMethod, getStaticMetaMethod, getTheClass, hashCode, hasProperty, invokeConstructor, invokeMethod, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, isGroovyObject, isModified, pickMethod, respondsTo, respondsTo, selectConstructorAndTransformArguments, setAdaptee, setAttribute, setAttribute, setMetaClass, setProperty, setProperty, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
HandleMetaClass
-
HandleMetaClass
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:MetaClass
Complete the initialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/properties 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 interfaceMetaClass
- Overrides:
initialize
in classDelegatingMetaClass
-
replaceDelegate
-
invokeMethod
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)Description copied from interface:GroovyObject
Invokes the given method.- Specified by:
invokeMethod
in interfaceGroovyObject
- Overrides:
invokeMethod
in classDelegatingMetaClass
- Parameters:
name
- the name of the method to callargs
- the arguments to use for the method call- Returns:
- the result of invoking the method
-
getProperty
public java.lang.Object getProperty(java.lang.String property)Description copied from interface:GroovyObject
Retrieves a property value.- Specified by:
getProperty
in interfaceGroovyObject
- Overrides:
getProperty
in classDelegatingMetaClass
- Parameters:
property
- the name of the property of interest- Returns:
- the given property
-
setProperty
public void setProperty(java.lang.String property, java.lang.Object newValue)Description copied from interface:GroovyObject
Sets the given property to the new value.- Specified by:
setProperty
in interfaceGroovyObject
- Overrides:
setProperty
in classDelegatingMetaClass
- Parameters:
property
- the name of the property of interestnewValue
- the new value for the property
-
addNewInstanceMethod
public void addNewInstanceMethod(java.lang.reflect.Method method)Description copied from interface:MutableMetaClass
adds a new instance method to this MetaClass. Instance methods are able to overwrite the original methods of the class. Calling this method should not be done after initialise was called.- Specified by:
addNewInstanceMethod
in interfaceMutableMetaClass
- Overrides:
addNewInstanceMethod
in classDelegatingMetaClass
- Parameters:
method
- the method to be added
-
addNewStaticMethod
public void addNewStaticMethod(java.lang.reflect.Method method)Description copied from interface:MutableMetaClass
adds a new static method to this MetaClass. This is only possible as long as initialise was not called.- Specified by:
addNewStaticMethod
in interfaceMutableMetaClass
- Overrides:
addNewStaticMethod
in classDelegatingMetaClass
- Parameters:
method
- the method to be added
-
addMetaMethod
Description copied from interface:MutableMetaClass
Adds a new MetaMethod to the MetaClass- Specified by:
addMetaMethod
in interfaceMutableMetaClass
- Overrides:
addMetaMethod
in classDelegatingMetaClass
- Parameters:
metaMethod
- The MetaMethod to add
-
addMetaBeanProperty
Description copied from interface:MutableMetaClass
Adds a new MetaBeanProperty to the MetaClass- Specified by:
addMetaBeanProperty
in interfaceMutableMetaClass
- Overrides:
addMetaBeanProperty
in classDelegatingMetaClass
- Parameters:
metaBeanProperty
- The MetaBeanProperty instance
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classDelegatingMetaClass
-