|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgroovy.lang.MetaClass
groovy.lang.MetaClassImpl
public class MetaClassImpl
Allows methods to be dynamically added to existing classes at runtime
MetaClass| Field Summary | |
|---|---|
protected MetaClassRegistry |
registry
|
| Fields inherited from class groovy.lang.MetaClass |
|---|
log, NO_METHOD_FOUND, theClass, useReflection |
| Constructor Summary | |
|---|---|
MetaClassImpl(MetaClassRegistry registry,
Class theClass)
|
|
| Method Summary | |
|---|---|
protected void |
addMetaMethod(MetaMethod method)
adds a MetaMethod to this class. |
void |
addNewInstanceMethod(Method method)
adds a new instance method to this meta class. |
void |
addNewStaticMethod(Method method)
adds a new static method to this meta class. |
protected void |
cacheInstanceMethod(MethodKey key,
MetaMethod method)
|
protected void |
cacheStaticMethod(MethodKey key,
MetaMethod method)
|
protected void |
checkInitalised()
checks if the initialisation of the class id complete. |
protected void |
clearInvocationCaches()
remove all method call cache entries. |
Object |
getAttribute(Class sender,
Object object,
String attribute,
boolean useSuper,
boolean fromInsideClass)
Looks up the given attribute (field) on the given object |
Object |
getAttribute(Object object,
String attribute)
Deprecated. |
ClassNode |
getClassNode()
|
List |
getMetaMethods()
|
List |
getMethods()
|
List |
getProperties()
Get all the properties defined for this type |
Object |
getProperty(Class sender,
Object object,
String name,
boolean useSuper,
boolean fromInsideClass)
|
Object |
getProperty(Object object,
String property)
Deprecated. |
void |
initialize()
complete the initlialisation process. |
Object |
invokeConstructor(Object[] arguments)
|
Object |
invokeMethod(Class sender,
Object object,
String methodName,
Object[] originalArguments,
boolean isCallToSuper,
boolean fromInsideClass)
Invokes the given method on the object. |
Object |
invokeMethod(Object object,
String methodName,
Object[] originalArguments)
Deprecated. |
Object |
invokeStaticMethod(Object object,
String methodName,
Object[] arguments)
|
protected boolean |
isInitialized()
|
MetaMethod |
pickMethod(Class sender,
String methodName,
Class[] arguments,
boolean isCallToSuper)
pick a method in a strict manner, i.e., without reinterpreting the first List argument. |
MetaMethod |
pickMethod(String methodName,
Class[] arguments)
Warning, this method will be removed until 1.0 |
Constructor |
retrieveConstructor(Class[] arguments)
|
MetaMethod |
retrieveMethod(Class sender,
String methodName,
Class[] arguments,
boolean isCallToSuper)
|
protected MetaMethod |
retrieveMethod(String methodName,
Class[] arguments)
Warning, this method will be removed until 1.0 |
MetaMethod |
retrieveStaticMethod(String methodName,
Class[] arguments)
|
int |
selectConstructorAndTransformArguments(int numberOfCosntructors,
Object[] arguments)
|
void |
setAttribute(Class sender,
Object object,
String attribute,
Object newValue,
boolean useSuper,
boolean fromInsideClass)
Sets the given attribute (field) on the given object |
void |
setAttribute(Object object,
String attribute,
Object newValue)
Deprecated. |
void |
setProperties(Object bean,
Map map)
Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set |
void |
setProperty(Class sender,
Object object,
String name,
Object newValue,
boolean useSuper,
boolean fromInsideClass)
Sets the property value on an object |
void |
setProperty(Object object,
String property,
Object newValue)
Deprecated. |
String |
toString()
|
| Methods inherited from class groovy.lang.MetaClass |
|---|
getAttribute, invokeConstructorAt, invokeMethod, invokeMissingMethod, isGroovyObject, isUseReflection, setUseReflection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected MetaClassRegistry registry
| Constructor Detail |
|---|
public MetaClassImpl(MetaClassRegistry registry,
Class theClass)
| Method Detail |
|---|
public void addNewInstanceMethod(Method method)
MetaClass
addNewInstanceMethod in class MetaClassmethod - the method to be addedpublic void addNewStaticMethod(Method method)
MetaClass
addNewStaticMethod in class MetaClassmethod - the method to be added
public Object invokeMethod(Object object,
String methodName,
Object[] originalArguments)
invokeMethod in class MetaClass
public Object invokeMethod(Class sender,
Object object,
String methodName,
Object[] originalArguments,
boolean isCallToSuper,
boolean fromInsideClass)
invokeMethod in class MetaClass
public MetaMethod retrieveMethod(Class sender,
String methodName,
Class[] arguments,
boolean isCallToSuper)
protected void cacheInstanceMethod(MethodKey key,
MetaMethod method)
protected void cacheStaticMethod(MethodKey key,
MetaMethod method)
public Constructor retrieveConstructor(Class[] arguments)
public MetaMethod retrieveStaticMethod(String methodName,
Class[] arguments)
public MetaMethod pickMethod(Class sender,
String methodName,
Class[] arguments,
boolean isCallToSuper)
methodName - arguments -
public Object invokeStaticMethod(Object object,
String methodName,
Object[] arguments)
invokeStaticMethod in class MetaClasspublic Object invokeConstructor(Object[] arguments)
invokeConstructor in class MetaClass
public int selectConstructorAndTransformArguments(int numberOfCosntructors,
Object[] arguments)
protected void checkInitalised()
IllegalStateException - if the initialisation is incomplete yet
public void setProperties(Object bean,
Map map)
public Object getProperty(Class sender,
Object object,
String name,
boolean useSuper,
boolean fromInsideClass)
getProperty in class MetaClasspublic List getProperties()
getProperties in class MetaClass
public void setProperty(Class sender,
Object object,
String name,
Object newValue,
boolean useSuper,
boolean fromInsideClass)
setProperty in class MetaClass
public Object getAttribute(Class sender,
Object object,
String attribute,
boolean useSuper,
boolean fromInsideClass)
public void setAttribute(Class sender,
Object object,
String attribute,
Object newValue,
boolean useSuper,
boolean fromInsideClass)
setAttribute in class MetaClasspublic ClassNode getClassNode()
getClassNode in class MetaClasspublic String toString()
toString in class Objectprotected void addMetaMethod(MetaMethod method)
method - the MetaMethodinitialize()protected boolean isInitialized()
public void initialize()
MetaClass
initialize in class MetaClasspublic List getMethods()
getMethods in class MetaClasspublic List getMetaMethods()
getMetaMethods in class MetaClass
public Object getProperty(Object object,
String property)
getProperty in class MetaClass
public void setProperty(Object object,
String property,
Object newValue)
setProperty in class MetaClass
public Object getAttribute(Object object,
String attribute)
getAttribute in class MetaClass
public void setAttribute(Object object,
String attribute,
Object newValue)
setAttribute in class MetaClass
public MetaMethod pickMethod(String methodName,
Class[] arguments)
MetaClass
pickMethod in class MetaClass
protected MetaMethod retrieveMethod(String methodName,
Class[] arguments)
MetaClass
retrieveMethod in class MetaClassprotected void clearInvocationCaches()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||