public interface MetaClass extends MetaObjectProtocol
MetaClassImpl
,
MetaObjectProtocol
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getAttribute(java.lang.Class sender,
java.lang.Object receiver,
java.lang.String messageName,
boolean useSuper)
Retrieves the value of an attribute (field).
|
ClassNode |
getClassNode()
Obtains a reference to the original AST for the MetaClass if it is available at runtime
|
java.util.List<MetaMethod> |
getMetaMethods()
Retrieves a list of MetaMethods held by this class
|
java.util.List<MetaMethod> |
getMethods()
Retrieves a list of MetaMethods held by the class
|
java.util.List<MetaProperty> |
getProperties()
Retrieves a list of MetaProperty instances that the MetaClass has
|
java.lang.Object |
getProperty(java.lang.Class sender,
java.lang.Object receiver,
java.lang.String property,
boolean isCallToSuper,
boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments.
|
void |
initialize()
complete the initialisation process.
|
java.lang.Object |
invokeMethod(java.lang.Class sender,
java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] arguments,
boolean isCallToSuper,
boolean fromInsideClass)
Invokes a method on the given receiver for the specified arguments.
|
java.lang.Object |
invokeMissingMethod(java.lang.Object instance,
java.lang.String methodName,
java.lang.Object[] arguments)
Attempts to invoke the methodMissing method otherwise throws a MissingMethodException
|
java.lang.Object |
invokeMissingProperty(java.lang.Object instance,
java.lang.String propertyName,
java.lang.Object optionalValue,
boolean isGetter)
Invokes the propertyMissing method otherwise throws a MissingPropertyException
|
MetaMethod |
pickMethod(java.lang.String methodName,
java.lang.Class[] arguments)
Selects a method by name and argument classes.
|
int |
selectConstructorAndTransformArguments(int numberOfConstructors,
java.lang.Object[] arguments)
Internal method to support Groovy runtime.
|
void |
setAttribute(java.lang.Class sender,
java.lang.Object receiver,
java.lang.String messageName,
java.lang.Object messageValue,
boolean useSuper,
boolean fromInsideClass)
Sets the value of an attribute (field).
|
void |
setProperty(java.lang.Class sender,
java.lang.Object receiver,
java.lang.String property,
java.lang.Object value,
boolean isCallToSuper,
boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments.
|
getAttribute, getMetaMethod, getMetaProperty, getProperty, getStaticMetaMethod, getTheClass, hasProperty, invokeConstructor, invokeMethod, invokeMethod, invokeStaticMethod, respondsTo, respondsTo, setAttribute, setProperty
java.lang.Object invokeMethod(java.lang.Class sender, java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)
Invokes a method on the given receiver for the specified arguments. The sender is the class that invoked the method on the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary
sender
- The java.lang.Class instance that invoked the methodreceiver
- The object which the method was invoked onmethodName
- The name of the methodarguments
- The arguments to the methodisCallToSuper
- Whether the method is a call to a super class methodfromInsideClass
- Whether the call was invoked from the inside or the outside of the classjava.lang.Object getProperty(java.lang.Class sender, java.lang.Object receiver, java.lang.String property, boolean isCallToSuper, boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments. The sender is the class that is requesting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary
sender
- The java.lang.Class instance that requested the propertyreceiver
- The Object which the property is being retrieved fromproperty
- The name of the propertyisCallToSuper
- Whether the call is to a super class propertyfromInsideClass
- ??void setProperty(java.lang.Class sender, java.lang.Object receiver, java.lang.String property, java.lang.Object value, boolean isCallToSuper, boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments. The sender is the class that is requesting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary
sender
- The java.lang.Class instance that is mutating the propertyreceiver
- The Object which the property is being set onproperty
- The name of the propertyvalue
- The new value of the property to setisCallToSuper
- Whether the call is to a super class propertyfromInsideClass
- ??java.lang.Object invokeMissingMethod(java.lang.Object instance, java.lang.String methodName, java.lang.Object[] arguments)
Attempts to invoke the methodMissing method otherwise throws a MissingMethodException
instance
- The instance to invoke methodMissing onmethodName
- The name of the methodarguments
- The arguments to the methodMissingMethodException
java.lang.Object invokeMissingProperty(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
instance
- The instance of the classpropertyName
- The name of the propertyoptionalValue
- The value of the property which could be null in the case of a getterisGetter
- Whether the missing property event was the result of a getter or a setterjava.lang.Object getAttribute(java.lang.Class sender, java.lang.Object receiver, java.lang.String messageName, boolean useSuper)
sender
- The class of the object that requested the attributereceiver
- The instancemessageName
- The name of the attributeuseSuper
- Whether to look-up on the super class or notvoid setAttribute(java.lang.Class sender, java.lang.Object receiver, java.lang.String messageName, java.lang.Object messageValue, boolean useSuper, boolean fromInsideClass)
sender
- The class of the object that requested the attributereceiver
- The instancemessageName
- The name of the attributemessageValue
- The value of the attributeuseSuper
- Whether to look-up on the super class or notfromInsideClass
- Whether the call happened from the inside or the outside of a classvoid initialize()
java.util.List<MetaProperty> getProperties()
getProperties
in interface MetaObjectProtocol
MetaProperty
java.util.List<MetaMethod> getMethods()
getMethods
in interface MetaObjectProtocol
MetaMethod
ClassNode getClassNode()
java.util.List<MetaMethod> getMetaMethods()
int selectConstructorAndTransformArguments(int numberOfConstructors, java.lang.Object[] arguments)
numberOfConstructors
- The number of constructorsarguments
- The argumentsMetaMethod pickMethod(java.lang.String methodName, java.lang.Class[] arguments)
methodName
- the name of the method to pickarguments
- the method argumentsGroovyRuntimeException
- if there is more than one matching method