Class MixedInMetaClass
java.lang.Object
groovy.lang.DelegatingMetaClass
org.codehaus.groovy.runtime.metaclass.OwnedMetaClass
org.codehaus.groovy.runtime.metaclass.MixedInMetaClass
- All Implemented Interfaces:
GroovyObject,MetaClass,MetaObjectProtocol,MutableMetaClass
A delegating MetaClass that allows mixing in a mixin object.
This class delegates method invocation to an owner object's MetaClass
while maintaining a weak reference to the owner to prevent memory leaks.
This implementation is for internal use by the Groovy runtime's mixin feature.
-
Field Summary
Fields inherited from class groovy.lang.DelegatingMetaClass
delegate -
Constructor Summary
ConstructorsConstructorDescriptionMixedInMetaClass(Object instance, Object owner) Constructs a new MixedInMetaClass. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectgetOwner()Returns the owner object whose MetaClass should be used for delegated operations.protected MetaClassgetOwnerMetaClass(Object owner) Returns the MetaClass of the owner object.invokeMethod(Class sender, Object receiver, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass) Invokes a method on the owner's MetaClass with caller context.Methods inherited from class org.codehaus.groovy.runtime.metaclass.OwnedMetaClass
equals, getAttribute, getAttribute, getClassNode, getMetaMethod, getMetaMethod, getMetaMethods, getMetaProperty, getMethods, getProperties, getProperty, getProperty, getStaticMetaMethod, getStaticMetaMethod, getTheClass, hashCode, hasProperty, invokeConstructor, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, isGroovyObject, respondsTo, respondsTo, selectConstructorAndTransformArguments, setAttribute, setAttribute, setProperty, setProperty, toStringMethods inherited from class groovy.lang.DelegatingMetaClass
addMetaBeanProperty, addMetaMethod, addNewInstanceMethod, addNewStaticMethod, getAdaptee, getMetaClass, getProperty, initialize, invokeMethod, isModified, pickMethod, setAdaptee, setMetaClass, setProperty
-
Constructor Details
-
MixedInMetaClass
Constructs a new MixedInMetaClass.- Parameters:
instance- the instance that will have the mixin appliedowner- the owner object that provides the mixin functionality
-
-
Method Details
-
getOwner
Description copied from class:OwnedMetaClassReturns the owner object whose MetaClass should be used for delegated operations.- Specified by:
getOwnerin classOwnedMetaClass- Returns:
- the owner object
-
getOwnerMetaClass
Description copied from class:OwnedMetaClassReturns the MetaClass of the owner object.- Specified by:
getOwnerMetaClassin classOwnedMetaClass- Parameters:
owner- the owner object- Returns:
- the owner's MetaClass
-
invokeMethod
public Object invokeMethod(Class sender, Object receiver, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass) Description copied from class:OwnedMetaClassInvokes a method on the owner's MetaClass with caller context.- Specified by:
invokeMethodin interfaceMetaClass- Overrides:
invokeMethodin classOwnedMetaClass- Parameters:
sender- the class making the requestreceiver- the receiver object (ignored; the owner is used instead)methodName- the method namearguments- the method argumentsisCallToSuper- whether this is a super method callfromInsideClass- whether this is called from inside the class- Returns:
- the method result
-