|
||||||||||
| 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
| Field Summary | |
|---|---|
protected MetaClassRegistry |
registry
|
| Fields inherited from class groovy.lang.MetaClass |
|---|
log, newGroovyMethodsList, NO_METHOD_FOUND, theClass, useReflection |
| Constructor Summary | |
|---|---|
MetaClassImpl(MetaClassRegistry registry,
Class theClass)
|
|
| Method Summary | |
|---|---|
protected void |
addNewInstanceMethod(Method method)
Allows static method definitions to be added to a meta class as if it was an instance method |
protected void |
addNewStaticMethod(Method method)
|
protected void |
checkInitialised()
|
Object |
getAttribute(Object object,
String attribute)
Looks up the given attribute (field) on the given object |
ClassNode |
getClassNode()
|
List |
getMetaMethods()
|
List |
getMethods()
|
List |
getProperties()
Get all the properties defined for this type |
Object |
getProperty(Object object,
String property)
|
Object |
invokeConstructor(Object[] arguments)
|
Object |
invokeConstructorAt(Class at,
Object[] arguments)
|
Object |
invokeMethod(Object object,
String methodName,
Object[] arguments)
Invokes the given method on the object. |
Object |
invokeStaticMethod(Object object,
String methodName,
Object[] arguments)
|
protected MetaMethod |
pickMethod(Object object,
String methodName,
Object[] arguments)
Picks which method to invoke for the given object, method name and arguments |
protected MetaMethod |
pickMethod(String methodName,
Class[] arguments)
pick a method in a strict manner, i.e., without reinterpreting the first List argument. |
Constructor |
retrieveConstructor(Class[] arguments)
|
MetaMethod |
retrieveMethod(Object owner,
String methodName,
Object[] arguments)
|
MetaMethod |
retrieveMethod(String methodName,
Class[] arguments)
|
MetaMethod |
retrieveStaticMethod(String methodName,
Class[] arguments)
|
void |
setAttribute(Object object,
String attribute,
Object newValue)
Sets the given attribute (field) on the given object |
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(Object object,
String property,
Object newValue)
Sets the property value on an object |
String |
toString()
|
| Methods inherited from class groovy.lang.MetaClass |
|---|
invokeMethod, 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)
throws IntrospectionException
IntrospectionException| Method Detail |
|---|
protected void addNewInstanceMethod(Method method)
addNewInstanceMethod in class MetaClassmethod - protected void addNewStaticMethod(Method method)
addNewStaticMethod in class MetaClass
public Object invokeMethod(Object object,
String methodName,
Object[] arguments)
invokeMethod in class MetaClass
public MetaMethod retrieveMethod(Object owner,
String methodName,
Object[] arguments)
retrieveMethod in class MetaClass
public MetaMethod retrieveMethod(String methodName,
Class[] arguments)
retrieveMethod in class MetaClasspublic Constructor retrieveConstructor(Class[] arguments)
retrieveConstructor in class MetaClass
public MetaMethod retrieveStaticMethod(String methodName,
Class[] arguments)
retrieveStaticMethod in class MetaClass
protected MetaMethod pickMethod(Object object,
String methodName,
Object[] arguments)
pickMethod in class MetaClass
protected MetaMethod pickMethod(String methodName,
Class[] arguments)
pickMethod in class MetaClassmethodName - arguments -
public Object invokeStaticMethod(Object object,
String methodName,
Object[] arguments)
invokeStaticMethod in class MetaClasspublic Object invokeConstructor(Object[] arguments)
invokeConstructor in class MetaClass
public Object invokeConstructorAt(Class at,
Object[] arguments)
invokeConstructorAt in class MetaClass
public void setProperties(Object bean,
Map map)
setProperties in class MetaClass
public Object getProperty(Object object,
String property)
getProperty in class MetaClasspublic List getProperties()
getProperties 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 MetaClasspublic ClassNode getClassNode()
getClassNode in class MetaClasspublic String toString()
toString in class Objectprotected void checkInitialised()
checkInitialised in class MetaClasspublic List getMethods()
getMethods in class MetaClasspublic List getMetaMethods()
getMetaMethods in class MetaClass
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||