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, Object obj)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMetaBeanProperty(MetaBeanProperty metaBeanProperty)Adds a new MetaBeanProperty to the MetaClassvoidaddMetaMethod(MetaMethod metaMethod)Adds a new MetaMethod to the MetaClassvoidaddNewInstanceMethod(Method method)adds a new instance method to this MetaClass.voidaddNewStaticMethod(Method method)adds a new static method to this MetaClass.booleanequals(Object obj)ObjectgetProperty(String property)Retrieves a property value.voidinitialize()Complete the initialisation process.ObjectinvokeMethod(String name, Object args)Invokes the given method.GroovyObjectreplaceDelegate()voidsetProperty(String property, 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
-
-
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:MetaClassComplete 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:
initializein interfaceMetaClass- Overrides:
initializein classDelegatingMetaClass
-
replaceDelegate
public GroovyObject replaceDelegate()
-
invokeMethod
public Object invokeMethod(String name, Object args)
Description copied from interface:GroovyObjectInvokes the given method.- Specified by:
invokeMethodin interfaceGroovyObject- Overrides:
invokeMethodin 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 Object getProperty(String property)
Description copied from interface:GroovyObjectRetrieves a property value.- Specified by:
getPropertyin interfaceGroovyObject- Overrides:
getPropertyin classDelegatingMetaClass- Parameters:
property- the name of the property of interest- Returns:
- the given property
-
setProperty
public void setProperty(String property, Object newValue)
Description copied from interface:GroovyObjectSets the given property to the new value.- Specified by:
setPropertyin interfaceGroovyObject- Overrides:
setPropertyin classDelegatingMetaClass- Parameters:
property- the name of the property of interestnewValue- the new value for the property
-
addNewInstanceMethod
public void addNewInstanceMethod(Method method)
Description copied from interface:MutableMetaClassadds 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:
addNewInstanceMethodin interfaceMutableMetaClass- Overrides:
addNewInstanceMethodin classDelegatingMetaClass- Parameters:
method- the method to be added
-
addNewStaticMethod
public void addNewStaticMethod(Method method)
Description copied from interface:MutableMetaClassadds a new static method to this MetaClass. This is only possible as long as initialise was not called.- Specified by:
addNewStaticMethodin interfaceMutableMetaClass- Overrides:
addNewStaticMethodin classDelegatingMetaClass- Parameters:
method- the method to be added
-
addMetaMethod
public void addMetaMethod(MetaMethod metaMethod)
Description copied from interface:MutableMetaClassAdds a new MetaMethod to the MetaClass- Specified by:
addMetaMethodin interfaceMutableMetaClass- Overrides:
addMetaMethodin classDelegatingMetaClass- Parameters:
metaMethod- The MetaMethod to add
-
addMetaBeanProperty
public void addMetaBeanProperty(MetaBeanProperty metaBeanProperty)
Description copied from interface:MutableMetaClassAdds a new MetaBeanProperty to the MetaClass- Specified by:
addMetaBeanPropertyin interfaceMutableMetaClass- Overrides:
addMetaBeanPropertyin classDelegatingMetaClass- Parameters:
metaBeanProperty- The MetaBeanProperty instance
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classDelegatingMetaClass
-
-