|
Groovy 1.7.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
groovy.lang.MetaObjectProtocolgroovy.lang.MetaClass
interface MetaClass extends MetaObjectProtocol
A MetaClass within Groovy defines the behaviour of any given Groovy or Java class. The MetaClass interface defines two parts. The client API, which is defined via the extend MetaObjectProtocol interface and the contract with the Groovy runtime system. In general the compiler and Groovy runtime engine interact with methods on this class whilst MetaClass clients interact with the method defined by the MetaObjectProtocol interface
Method Summary | |
---|---|
Object
|
getAttribute(Class sender, Object receiver, 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 |
List
|
getMetaMethods()
Retrieves a list of MetaMethods held by this class |
List
|
getMethods()
Retrieves a list of MetaMethods held by the class |
List
|
getProperties()
Retrives a list of MetaProperty instances that the MetaClass has |
Object
|
getProperty(Class sender, Object receiver, String property, boolean isCallToSuper, boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments. |
void
|
initialize()
complete the initlialisation process. |
Object
|
invokeMethod(Class sender, Object receiver, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)
Invokes a method on the given receiver for the specified arguments. |
Object
|
invokeMissingMethod(Object instance, String methodName, Object[] arguments)
Attempts to invoke the methodMissing method otherwise throws a MissingMethodException |
Object
|
invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
Invokes the propertyMissing method otherwise throws a MissingPropertyException |
MetaMethod
|
pickMethod(String methodName, Class[] arguments)
Selects a method by name and argument classes. |
int
|
selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)
Internal method to support Groovy runtime. |
void
|
setAttribute(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)
Sets the value of an attribute (field). |
void
|
setProperty(Class sender, Object receiver, String property, Object value, boolean isCallToSuper, boolean fromInsideClass)
Retrieves a property on the given receiver for the specified arguments. |
Methods inherited from interface MetaObjectProtocol | |
---|---|
getAttribute, getMetaMethod, getMetaProperty, getMethods, getProperties, getProperty, getStaticMetaMethod, getTheClass, hasProperty, invokeConstructor, invokeMethod, invokeMethod, invokeStaticMethod, respondsTo, respondsTo, setAttribute, setProperty |
Method Detail |
---|
public Object getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)
public ClassNode getClassNode()
public List getMetaMethods()
public List getMethods()
public List getProperties()
public Object getProperty(Class sender, Object receiver, 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
public void initialize()
public Object invokeMethod(Class sender, Object receiver, String methodName, 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
public Object invokeMissingMethod(Object instance, String methodName, Object[] arguments)
Attempts to invoke the methodMissing method otherwise throws a MissingMethodException
public Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
public MetaMethod pickMethod(String methodName, Class[] arguments)
public int selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)
public void setAttribute(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)
public void setProperty(Class sender, Object receiver, String property, 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
Copyright © 2003-2009 The Codehaus. All rights reserved.