| java.lang.Object groovy.lang.MetaClass
All known Subclasses: groovy.lang.MetaClassImpl, groovy.lang.DelegatingMetaClass,
MetaClass | abstract public class MetaClass (Code) | | Base class for meta class implementations.
The meta class is used to invoke methods or to get
fields/properties. For proper initialization of this class
it is not enough to only call the constructor, the
initialize() must be called too. The invoke methods should
check that initialize() was called. Adding methods is
valid unless initilise method was called. Therefore
addNewStaticMethod and addNewInstanceMethod should check that
that initilise awas not called before.
author: John Wilson |
Method Summary | |
abstract public void | addNewInstanceMethod(Method method) adds a new instance method to this meta class. | abstract public void | addNewStaticMethod(Method method) adds a new static method to this meta class. | public Object | getAttribute(Class sender, Object receiver, String messageName, boolean useSuper) | abstract public Object | getAttribute(Object object, String attribute) | abstract public ClassNode | getClassNode() | abstract public List | getMetaMethods() | abstract public List | getMethods() | abstract public List | getProperties() | public Object | getProperty(Class sender, Object receiver, String messageName, boolean useSuper, boolean fromInsideClass) | abstract public Object | getProperty(Object object, String property) | abstract public void | initialize() complete the initlialisation process. | abstract public Object | invokeConstructor(Object[] arguments) | public Object | invokeConstructorAt(Class at, Object[] arguments) | public Object | invokeMethod(Object object, String methodName, Object arguments) | public Object | invokeMethod(Class sender, Object receiver, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass) | abstract public Object | invokeMethod(Object object, String methodName, Object[] arguments) | public Object | invokeMissingMethod(Object instance, String methodName, Object[] arguments) | abstract public Object | invokeStaticMethod(Object object, String methodName, Object[] arguments) | public boolean | isGroovyObject() | public static boolean | isUseReflection() | abstract public MetaMethod | pickMethod(String methodName, Class[] arguments) Selects a method by name and argument classes. | protected MetaMethod | retrieveMethod(String methodName, Class[] arguments) | public void | setAttribute(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass) | abstract public void | setAttribute(Object object, String attribute, Object newValue) | public void | setProperty(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass) | abstract public void | setProperty(Object object, String property, Object newValue) | public static void | setUseReflection(boolean useReflection) Allows reflection to be enabled in situations where bytecode generation
of method invocations causes issues. |
NO_METHOD_FOUND | final public static Object NO_METHOD_FOUND(Code) | | |
useReflection | protected static boolean useReflection(Code) | | |
addNewInstanceMethod | abstract public void addNewInstanceMethod(Method method)(Code) | | adds a new instance method to this meta class. Instance
methods are able to overwrite the original methods of the
class. Calling this method should not be done after
initlise was called.
Parameters: method - the method to be added |
addNewStaticMethod | abstract public void addNewStaticMethod(Method method)(Code) | | adds a new static method to this meta class. This is only
possible as long as initilise was not called.
Parameters: method - the method to be added |
getMetaMethods | abstract public List getMetaMethods()(Code) | | |
getProperties | abstract public List getProperties()(Code) | | |
initialize | abstract public void initialize()(Code) | | complete the initlialisation process. After this method
is called no methods should be added to the meta class.
Invocation of methods or access to fields/proeprties 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.
|
invokeConstructorAt | public Object invokeConstructorAt(Class at, Object[] arguments)(Code) | | Warning, this method will be removed
|
isGroovyObject | public boolean isGroovyObject()(Code) | | |
isUseReflection | public static boolean isUseReflection()(Code) | | |
pickMethod | abstract public MetaMethod pickMethod(String methodName, Class[] arguments)(Code) | | Selects a method by name and argument classes. This method
does not search for an exact match, it searches for a compatible
method. For this the method selection mechanism is used as provided
bye the implementation of this MetaClass. pickMethod may or may
not used during the method selection process when invoking a method
thereis no warranty for that.
throws: GroovyRuntimeException - if there is more than one matching method |
setAttribute | public void setAttribute(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)(Code) | | |
setProperty | public void setProperty(Class sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)(Code) | | |
setUseReflection | public static void setUseReflection(boolean useReflection)(Code) | | Allows reflection to be enabled in situations where bytecode generation
of method invocations causes issues.
Parameters: useReflection - |
|
|