Warning
This implementation of ProxyMetaClass is NOT thread-safe 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
groovy.lang.MetaClassRegistry
| Modifier and Type | Field and Description |
|---|---|
| protected MetaClass | |
| protected Interceptor |
| Access | Constructor and Description |
|---|---|
| public | ProxyMetaClass(final MetaClassRegistry registry, final Class<T> theClass, final MetaClass
the MetaClass to decorate with interceptability adaptee)
|
| Modifier and Type | Method and Description |
|---|---|
| private Object | |
| public MetaClass | getAdaptee()
Implements groovy. |
| public static ProxyMetaClass | |
| public Interceptor | |
| public Object | Returns: the value of the propertyThe java.lang.Class instance that requested the property aClass, final Object the object to invoke the getter on object, final String the property name property, final boolean Whether the call is to a super class property useSuper, final boolean ?? fromInsideClass)Overrides groovy. Implements groovy. |
| public synchronized void | initialize()
Overrides groovy. Implements groovy. |
| public Object | invokeConstructor(final Object[]
The arguments to the constructor arguments)Overrides groovy. Implements groovy. |
| public Object | invokeMethod(final Object
The instance which the method is invoked on object, final String The name of the method methodName, final Object[] The arguments to the method arguments)Overrides groovy. Implements groovy. |
| public Object | invokeMethod(final Class<T>
The java.lang.Class instance that invoked the method sender, final Object The object which the method was invoked on object, final String The name of the method methodName, final Object[] The arguments to the method arguments, final boolean Whether the method is a call to a super class method isCallToSuper, final boolean Whether the call was invoked from the inside or the outside of the class fromInsideClass)Overrides groovy. Implements groovy. |
| public Object | invokeStaticMethod(final Object
An instance of the class returned by the getTheClass() method or the class itself object, final String The name of the method methodName, final Object[] The arguments to the method arguments)Overrides groovy. Implements groovy. |
| public void | setAdaptee(final MetaClass
The MetaClass to adapt metaClass)Implements groovy. |
| public void | |
| public void | setProperty(final Class<T>
The java.lang.Class instance that is mutating the property aClass, final Object The object to invoke the setter on object, final String The property name to set property, final Object The new value of the property newValue, final boolean Whether the call is to a super class property useSuper, final boolean Whether the call was invoked from the inside or the outside of the class fromInsideClass)Overrides groovy. Implements groovy. |
| public Object | |
| public Object | use(final GroovyObject object, final Closure<V>
piece of code to be executed with ProxyMetaClass closure)Use the ProxyMetaClass for the given Closure. |
| adaptee | back to summary |
|---|---|
| protected MetaClass adaptee | |
| interceptor | back to summary |
|---|---|
| protected Interceptor interceptor | |
| ProxyMetaClass | back to summary |
|---|---|
public ProxyMetaClass(final MetaClassRegistry registry, final Class<T> theClass, final MetaClass adaptee)
| |
| doCall | back to summary |
|---|---|
| private Object doCall(final Object object, final String methodName, final Object[] arguments, final Interceptor interceptor, final Supplier<Object> howToInvoke) | |
| getAdaptee | back to summary |
|---|---|
| public MetaClass getAdaptee() Implements groovy. Doc from groovy. Returns the MetaClass that this adapter adapts | |
| getInstance | back to summary |
|---|---|
| public static ProxyMetaClass getInstance(final Class<T> theClass) convenience factory method for the most usual case. | |
| getInterceptor | back to summary |
|---|---|
public Interceptor getInterceptor()
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(final Class<T> aClass, final Object object, final String property, final boolean useSuper, final boolean fromInsideClass) Overrides groovy. Implements groovy. Interceptors the call to getProperty if a PropertyAccessInterceptor is available
| |
| initialize | back to summary |
|---|---|
| public synchronized void initialize() Overrides groovy. Implements groovy. Doc from groovy. Complete the initialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/properties 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.
| |
| invokeConstructor | back to summary |
|---|---|
| public Object invokeConstructor(final Object[] arguments) Overrides groovy. Implements groovy. Call invokeConstructor on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
| |
| invokeMethod | back to summary |
|---|---|
| public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) Overrides groovy. Implements groovy. Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
| |
| invokeMethod | back to summary |
|---|---|
| public Object invokeMethod(final Class<T> sender, final Object object, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) Overrides groovy. Implements groovy. Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
| |
| invokeStaticMethod | back to summary |
|---|---|
| public Object invokeStaticMethod(final Object object, final String methodName, final Object[] arguments) Overrides groovy. Implements groovy. Call invokeStaticMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
| |
| setAdaptee | back to summary |
|---|---|
| public void setAdaptee(final MetaClass metaClass) Implements groovy. Doc from groovy. Sets the MetaClass adapted by this MetaClass | |
| setInterceptor | back to summary |
|---|---|
public void setInterceptor(final Interceptor interceptor)
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(final Class<T> aClass, final Object object, final String property, final Object newValue, final boolean useSuper, final boolean fromInsideClass) Overrides groovy. Implements groovy. Interceptors the call to a property setter if a PropertyAccessInterceptor is available
| |
| use | back to summary |
|---|---|
| public Object use(final Closure<V> closure) Use the ProxyMetaClass for the given Closure. Cares for balanced register/unregister.
| |
| use | back to summary |
|---|---|
| public Object use(final GroovyObject object, final Closure<V> closure) Use the ProxyMetaClass for the given Closure. Cares for balanced setting/unsetting ProxyMetaClass.
| |