Groovy Documentation

groovy.mock.interceptor
[Java] Class MockProxyMetaClass

java.lang.Object
  groovy.lang.MetaClassImpl
      groovy.lang.ProxyMetaClass
          groovy.mock.interceptor.MockProxyMetaClass

public class MockProxyMetaClass
extends ProxyMetaClass

The ProxyMetaClass for the MockInterceptor. Instance and class methods are intercepted, but constructors are not to allow mocking of aggregated objects.

Authors:
Dierk Koenig


Field Summary
boolean interceptConstruction

 
Method Summary
java.lang.Object MockProxyMetaClass(MetaClassRegistry registry, java.lang.Class theClass, MetaClass adaptee)

@param adaptee the MetaClass to decorate with interceptability

java.lang.Object MockProxyMetaClass(MetaClassRegistry registry, java.lang.Class theClass, MetaClass adaptee, boolean interceptConstruction)

@param adaptee the MetaClass to decorate with interceptability

java.lang.Object getProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, boolean b, boolean b1)

java.lang.Object invokeConstructor(java.lang.Object[] arguments)

Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.

java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)

java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)

static MockProxyMetaClass make(java.lang.Class theClass)

convenience factory method for the most usual case.

static MockProxyMetaClass make(java.lang.Class theClass, boolean interceptConstruction)

convenience factory method allowing interceptConstruction to be set.

void setProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, java.lang.Object newValue, boolean b, boolean b1)

 
Methods inherited from class ProxyMetaClass
invokeMethod, invokeConstructor, invokeStaticMethod, use, use, getAdaptee, setAdaptee, setInterceptor, getInterceptor, setProperty, getProperty, getInstance, initialize, getTheClass, hasProperty, invokeMethod, invokeMethod, getClassNode, getClassInfo, pickMethod, getMetaMethod, invokeMissingMethod, respondsTo, respondsTo, invokeMissingProperty, getMetaMethods, selectConstructorAndTransformArguments, getMetaProperty, getStaticMetaMethod, incVersion, createPojoCallSite, getTheCachedClass, getMethodWithoutCaching, addMetaBeanProperty, isModified, addNewInstanceMethod, addNewStaticMethod, getMethodWithCaching, retrieveConstructor, retrieveStaticMethod, getEffectiveGetMetaProperty, addMetaMethod, getAdditionalMetaMethods, isGroovyObject, createStaticSite, createPogoCallSite, createPogoCallCurrentSite, createConstructorSite, setProperty, getProperty, toString, getMethods, getProperties, setProperties, getAttribute, getAttribute, getAttribute, setAttribute, setAttribute, getVersion, getRegistry, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 
Methods inherited from class MetaClassImpl
getTheClass, hasProperty, invokeMethod, invokeMethod, invokeMethod, getClassNode, getClassInfo, pickMethod, getMetaMethod, invokeConstructor, invokeStaticMethod, invokeMissingMethod, respondsTo, respondsTo, invokeMissingProperty, getMetaMethods, selectConstructorAndTransformArguments, getMetaProperty, getStaticMetaMethod, incVersion, createPojoCallSite, getTheCachedClass, getMethodWithoutCaching, addMetaBeanProperty, isModified, addNewInstanceMethod, addNewStaticMethod, getMethodWithCaching, retrieveConstructor, retrieveStaticMethod, getEffectiveGetMetaProperty, addMetaMethod, getAdditionalMetaMethods, isGroovyObject, createStaticSite, createPogoCallSite, createPogoCallCurrentSite, createConstructorSite, setProperty, setProperty, getProperty, getProperty, toString, getMethods, getProperties, setProperties, initialize, getAttribute, getAttribute, getAttribute, setAttribute, setAttribute, getVersion, getRegistry, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 

Field Detail

interceptConstruction

public final boolean interceptConstruction


 
Method Detail

MockProxyMetaClass

public java.lang.Object MockProxyMetaClass(MetaClassRegistry registry, java.lang.Class theClass, MetaClass adaptee)
Parameters:
adaptee - the MetaClass to decorate with interceptability


MockProxyMetaClass

public java.lang.Object MockProxyMetaClass(MetaClassRegistry registry, java.lang.Class theClass, MetaClass adaptee, boolean interceptConstruction)
Parameters:
adaptee - the MetaClass to decorate with interceptability


getProperty

public java.lang.Object getProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, boolean b, boolean b1)


invokeConstructor

public java.lang.Object invokeConstructor(java.lang.Object[] arguments)
Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.


invokeMethod

public java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)


invokeStaticMethod

public java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)


make

public static MockProxyMetaClass make(java.lang.Class theClass)
convenience factory method for the most usual case.


make

public static MockProxyMetaClass make(java.lang.Class theClass, boolean interceptConstruction)
convenience factory method allowing interceptConstruction to be set.


setProperty

public void setProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, java.lang.Object newValue, boolean b, boolean b1)


 

Groovy Documentation