public abstract class OwnedMetaClass
extends DelegatingMetaClass
An abstract delegating MetaClass that delegates calls to an owner object's MetaClass. Subclasses must provide an owner object via the getOwner() method. This is used in Groovy for features like mixins that require delegation to an owner's metaclass for method and property access.
This class is for internal use by the Groovy runtime.
| Fields inherited from class | Fields |
|---|---|
class DelegatingMetaClass |
delegate |
| Constructor and description |
|---|
OwnedMetaClass(MetaClass delegate)Constructs a new OwnedMetaClass. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
equals(Object obj)Compares this OwnedMetaClass with another object using the delegate's equality. |
|
public Object |
getAttribute(Object object, String attribute)Retrieves the value of an attribute on the owner's MetaClass. |
|
public Object |
getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)Gets an attribute from the owner's MetaClass with caller context. |
|
public ClassNode |
getClassNode()Returns the AST ClassNode for the owner's class. |
|
public MetaMethod |
getMetaMethod(String name, Object[] args)Gets a metamethod from the owner's MetaClass by name and argument objects. |
|
public MetaMethod |
getMetaMethod(String name, Class[] argTypes)Gets a metamethod from the owner's MetaClass by name and argument types. |
|
public List<MetaMethod> |
getMetaMethods()Returns all metamethods from the owner's MetaClass. |
|
public MetaProperty |
getMetaProperty(String name)Gets the MetaProperty with the given name from the owner's MetaClass. |
|
public List<MetaMethod> |
getMethods()Returns all methods from the owner's MetaClass. |
|
protected abstract Object |
getOwner()Returns the owner object whose MetaClass should be used for delegated operations. |
|
protected abstract MetaClass |
getOwnerMetaClass(Object owner)Returns the MetaClass of the owner object. |
|
public List<MetaProperty> |
getProperties()Returns all properties from the owner's MetaClass. |
|
public Object |
getProperty(Object object, String property)Gets a property value from the owner's MetaClass. |
|
public Object |
getProperty(Class sender, Object receiver, String messageName, boolean useSuper, boolean fromInsideClass)Gets a property from the owner's MetaClass with caller context. |
|
public MetaMethod |
getStaticMetaMethod(String name, Object[] args)Gets a static metamethod from the owner's MetaClass by name and argument objects. |
|
public MetaMethod |
getStaticMetaMethod(String name, Class[] argTypes)Gets a static metamethod from the owner's MetaClass by name and argument types. |
|
public Class |
getTheClass()Returns the class that this MetaClass represents. |
|
public MetaProperty |
hasProperty(Object obj, String name)Retrieves the MetaProperty with the given name from the owner's MetaClass. |
|
public int |
hashCode()Returns the hash code of the delegate MetaClass. |
|
public Object |
invokeConstructor(Object[] arguments)Invokes a constructor on the owner's MetaClass. |
|
public Object |
invokeMethod(Object object, String methodName, Object arguments)Invokes a method on the owner's MetaClass with the specified arguments. |
|
public Object |
invokeMethod(Object object, String methodName, Object[] arguments)Invokes a method on the owner's MetaClass with the specified array of arguments. |
|
public 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. |
|
public Object |
invokeMissingMethod(Object instance, String methodName, Object[] arguments)Invokes a missing method on the owner's MetaClass. |
|
public Object |
invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)Invokes a missing property on the owner's MetaClass. |
|
public Object |
invokeStaticMethod(Object object, String methodName, Object[] arguments)Invokes a static method on the owner's MetaClass. |
|
public boolean |
isGroovyObject()Checks if the owner's class is a GroovyObject. |
|
public List<MetaMethod> |
respondsTo(Object obj, String name, Object[] argTypes)Returns all metamethods that respond to the given method name and argument types. |
|
public List<MetaMethod> |
respondsTo(Object obj, String name)Returns all metamethods that respond to the given method name. |
|
public int |
selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)Selects a constructor and transforms arguments for the owner's metaclass. |
|
public void |
setAttribute(Object object, String attribute, Object newValue)Sets the value of an attribute on the owner's MetaClass. |
|
public void |
setAttribute(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)Sets an attribute on the owner's MetaClass with caller context. |
|
public void |
setProperty(Object object, String property, Object newValue)Sets a property value on the owner's MetaClass. |
|
public void |
setProperty(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)Sets a property on the owner's MetaClass with caller context. |
|
public String |
toString()Returns a string representation of this OwnedMetaClass. |
Constructs a new OwnedMetaClass.
delegate - the MetaClass to delegate toCompares this OwnedMetaClass with another object using the delegate's equality.
obj - the object to compare withRetrieves the value of an attribute on the owner's MetaClass.
object - the object (ignored; the owner is used instead)attribute - the attribute nameGets an attribute from the owner's MetaClass with caller context.
sender - the class making the requestreceiver - the receiver object (ignored; the owner is used instead)messageName - the attribute nameuseSuper - whether to use the super methodReturns the AST ClassNode for the owner's class.
Gets a metamethod from the owner's MetaClass by name and argument objects.
name - the method nameargs - the argument objectsGets a metamethod from the owner's MetaClass by name and argument types.
name - the method nameargTypes - the argument typesReturns all metamethods from the owner's MetaClass.
Gets the MetaProperty with the given name from the owner's MetaClass.
name - the property nameReturns all methods from the owner's MetaClass.
Returns the owner object whose MetaClass should be used for delegated operations.
Returns the MetaClass of the owner object.
owner - the owner objectReturns all properties from the owner's MetaClass.
Gets a property value from the owner's MetaClass.
object - the object (ignored; the owner is used instead)property - the property nameGets a property from the owner's MetaClass with caller context.
sender - the class making the requestreceiver - the receiver object (ignored; the owner is used instead)messageName - the property nameuseSuper - whether to use the super methodfromInsideClass - whether this is called from inside the classGets a static metamethod from the owner's MetaClass by name and argument objects.
name - the method nameargs - the argument objectsGets a static metamethod from the owner's MetaClass by name and argument types.
name - the method nameargTypes - the argument typesReturns the class that this MetaClass represents.
Retrieves the MetaProperty with the given name from the owner's MetaClass.
obj - the object (ignored; the owner is used instead)name - the property nameReturns the hash code of the delegate MetaClass.
Invokes a constructor on the owner's MetaClass.
arguments - the constructor argumentsInvokes a method on the owner's MetaClass with the specified arguments.
object - the object (ignored; the owner is used instead)methodName - the method namearguments - the method arguments (as a single object or varargs)Invokes a method on the owner's MetaClass with the specified array of arguments.
object - the object (ignored; the owner is used instead)methodName - the method namearguments - the method arguments as an arrayInvokes a method on the owner's MetaClass with caller context.
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 classInvokes a missing method on the owner's MetaClass.
instance - the instance (ignored; the owner is used instead)methodName - the method name that was missingarguments - the method argumentsInvokes a missing property on the owner's MetaClass.
instance - the instance (ignored; the owner is used instead)propertyName - the property name that was missingoptionalValue - the optional value (for setters)isGetter - whether this is a getter operationInvokes a static method on the owner's MetaClass.
object - the class objectmethodName - the method namearguments - the method argumentsChecks if the owner's class is a GroovyObject.
Returns all metamethods that respond to the given method name and argument types.
obj - the object (ignored; the owner is used instead)name - the method nameargTypes - the argument typesReturns all metamethods that respond to the given method name.
obj - the object (ignored; the owner is used instead)name - the method nameSelects a constructor and transforms arguments for the owner's metaclass.
numberOfConstructors - the number of constructors availablearguments - the constructor arguments to transformSets the value of an attribute on the owner's MetaClass.
object - the object (ignored; the owner is used instead)attribute - the attribute namenewValue - the new attribute valueSets an attribute on the owner's MetaClass with caller context.
sender - the class making the requestreceiver - the receiver object (ignored; the owner is used instead)messageName - the attribute namemessageValue - the new attribute valueuseSuper - whether to use the super methodfromInsideClass - whether this is called from inside the classSets a property value on the owner's MetaClass.
object - the object (ignored; the owner is used instead)property - the property namenewValue - the new property valueSets a property on the owner's MetaClass with caller context.
sender - the class making the requestreceiver - the receiver object (ignored; the owner is used instead)messageName - the property namemessageValue - the new property valueuseSuper - whether to use the super methodfromInsideClass - whether this is called from inside the classReturns a string representation of this OwnedMetaClass.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.