|
Groovy 1.7.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.MetaClassImpl
groovy.lang.ProxyMetaClass
class ProxyMetaClass extends MetaClassImpl
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.
WARNING: This implementation of ProxyMetaClass is NOT threadsafe and hence should only be used for as a per-instance MetaClass running in a single thread. Do not place this MetaClass in the MetaClassRegistry as it will result in unpredictable behaviour
Nested Class Summary | |
---|---|
interface |
ProxyMetaClass.Callable
|
Field Summary | |
---|---|
protected MetaClass |
adaptee
|
protected Interceptor |
interceptor
|
Constructor Summary | |
ProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee)
|
Method Summary | |
---|---|
MetaClass
|
getAdaptee()
|
static ProxyMetaClass
|
getInstance(Class theClass)
convenience factory method for the most usual case. |
Interceptor
|
getInterceptor()
|
Object
|
getProperty(Class aClass, Object object, String property, boolean b, boolean b1)
Interceptors the call to getProperty if a PropertyAccessInterceptor is available |
void
|
initialize()
|
Object
|
invokeConstructor(Object[] arguments)
Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor. |
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
|
setAdaptee(MetaClass metaClass)
|
void
|
setInterceptor(Interceptor interceptor)
|
void
|
setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1)
Interceptors the call to a property setter if a PropertyAccessInterceptor is available |
Object
|
use(Closure closure)
Use the ProxyMetaClass for the given Closure. |
Object
|
use(GroovyObject object, Closure closure)
Use the ProxyMetaClass for the given Closure. |
Methods inherited from class MetaClassImpl | |
---|---|
getMetaMethod, getMetaProperty, getStaticMetaMethod, getSuperClasses, getTheCachedClass, getTheClass, hasProperty, isGroovyObject, respondsTo, respondsTo |
Methods inherited from class Object | |
---|---|
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll |
Field Detail |
---|
protected MetaClass adaptee
protected Interceptor interceptor
Constructor Detail |
---|
public ProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee)
Method Detail |
---|
public MetaClass getAdaptee()
public static ProxyMetaClass getInstance(Class theClass)
public Interceptor getInterceptor()
public Object getProperty(Class aClass, Object object, String property, boolean b, boolean b1)
public void initialize()
public Object invokeConstructor(Object[] arguments)
public Object invokeMethod(Object object, String methodName, Object[] arguments)
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
public void setAdaptee(MetaClass metaClass)
public void setInterceptor(Interceptor interceptor)
public void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1)
public Object use(Closure closure)
public Object use(GroovyObject object, Closure closure)
Copyright © 2003-2009 The Codehaus. All rights reserved.