|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.MetaClass
groovy.lang.MetaClassImpl
groovy.lang.ProxyMetaClass
As subclass of MetaClass, ProxyMetaClass manages calls from Groovy Objects to POJOs. It enriches MetaClass with the feature of making method invokations interceptable by an Interceptor. To this end, it acts as a decorator (decorator pattern) allowing to add or withdraw this feature at runtime. See groovy/lang/InterceptorTest.groovy for details.
Field Summary | |
protected MetaClass |
adaptee
|
protected Interceptor |
interceptor
|
Fields inherited from class groovy.lang.MetaClassImpl |
registry |
Fields inherited from class groovy.lang.MetaClass |
log, newGroovyMethodsList, NO_METHOD_FOUND, theClass, useReflection |
Constructor Summary | |
ProxyMetaClass(MetaClassRegistry registry,
Class theClass,
MetaClass adaptee)
|
Method Summary | |
static ProxyMetaClass |
getInstance(Class theClass)
convenience factory method for the most usual case. |
Interceptor |
getInterceptor()
|
Object |
invokeConstructor(Object[] arguments)
Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor. |
Object |
invokeConstructorAt(Class at,
Object[] arguments)
|
Object |
invokeMethod(Object object,
String methodName,
Object[] arguments)
Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. |
Object |
invokeStaticMethod(Object object,
String methodName,
Object[] arguments)
Call invokeStaticMethod on adaptee with logic like in MetaClass unless we have an Interceptor. |
void |
setInterceptor(Interceptor interceptor)
|
void |
use(Closure closure)
Use the ProxyMetaClass for the given Closure. |
void |
use(GroovyObject object,
Closure closure)
Use the ProxyMetaClass for the given Closure. |
Methods inherited from class groovy.lang.MetaClassImpl |
addNewInstanceMethod, addNewStaticMethod, checkInitialised, getAttribute, getClassNode, getMetaMethods, getMethods, getProperties, getProperty, pickMethod, pickMethod, retrieveConstructor, retrieveMethod, retrieveMethod, retrieveStaticMethod, setAttribute, setProperties, setProperty, 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 MetaClass adaptee
protected Interceptor interceptor
Constructor Detail |
public ProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee) throws IntrospectionException
adaptee
- the MetaClass to decorate with interceptabilityMethod Detail |
public static ProxyMetaClass getInstance(Class theClass) throws IntrospectionException
IntrospectionException
public void use(Closure closure)
closure
- piece of code to be executed with registered ProxyMetaClasspublic void use(GroovyObject object, Closure closure)
closure
- piece of code to be executed with ProxyMetaClasspublic Interceptor getInterceptor()
public void setInterceptor(Interceptor interceptor)
interceptor
- may be null to reset any interceptionpublic Object invokeMethod(Object object, String methodName, Object[] arguments)
invokeMethod
in class MetaClassImpl
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
invokeStaticMethod
in class MetaClassImpl
public Object invokeConstructor(Object[] arguments)
invokeConstructor
in class MetaClassImpl
public Object invokeConstructorAt(Class at, Object[] arguments)
invokeConstructorAt
in class MetaClassImpl
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |