Package groovy.mock.interceptor
Class MockProxyMetaClass
java.lang.Object
groovy.lang.MetaClassImpl
groovy.lang.ProxyMetaClass
groovy.mock.interceptor.MockProxyMetaClass
- All Implemented Interfaces:
groovy.lang.AdaptingMetaClass,groovy.lang.MetaClass,groovy.lang.MetaObjectProtocol,groovy.lang.MutableMetaClass
public class MockProxyMetaClass
extends groovy.lang.ProxyMetaClass
The ProxyMetaClass for the MockInterceptor.
Instance and class methods are intercepted, but constructors are not to allow mocking of aggregated objects.
-
Nested Class Summary
Nested classes/interfaces inherited from class groovy.lang.MetaClassImpl
groovy.lang.MetaClassImpl.Index, groovy.lang.MetaClassImpl.MetaConstructor -
Field Summary
Fields Modifier and Type Field Description booleaninterceptConstructionFields inherited from class groovy.lang.ProxyMetaClass
adaptee, interceptorFields inherited from class groovy.lang.MetaClassImpl
EMPTY_ARGUMENTS, getPropertyMethod, INVOKE_METHOD_METHOD, invokeMethodMethod, isGroovyObject, isMap, metaMethodIndex, METHOD_MISSING, PROPERTY_MISSING, registry, setPropertyMethod, STATIC_METHOD_MISSING, STATIC_PROPERTY_MISSING, theCachedClass, theClass -
Constructor Summary
Constructors Constructor Description MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, java.lang.Class theClass, groovy.lang.MetaClass adaptee)MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, java.lang.Class theClass, groovy.lang.MetaClass adaptee, boolean interceptConstruction) -
Method Summary
Modifier and Type Method Description java.lang.ObjectgetProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, boolean b, boolean b1)java.lang.ObjectinvokeConstructor(java.lang.Object[] arguments)Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.java.lang.ObjectinvokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)java.lang.ObjectinvokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)java.lang.ObjectinvokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)static MockProxyMetaClassmake(java.lang.Class theClass)convenience factory method for the most usual case.static MockProxyMetaClassmake(java.lang.Class theClass, boolean interceptConstruction)convenience factory method allowing interceptConstruction to be set.voidsetProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, java.lang.Object newValue, boolean b, boolean b1)Methods inherited from class groovy.lang.ProxyMetaClass
getAdaptee, getInstance, getInterceptor, initialize, setAdaptee, setInterceptor, use, useMethods inherited from class groovy.lang.MetaClassImpl
addMetaBeanProperty, addMetaMethod, addMetaMethodToIndex, addNewInstanceMethod, addNewStaticMethod, applyPropertyDescriptors, checkIfGroovyObjectMethod, checkInitalised, chooseMethod, clearInvocationCaches, createConstructorSite, createErrorMessageForAmbiguity, createPogoCallCurrentSite, createPogoCallSite, createPojoCallSite, createStaticSite, createTransformMetaMethod, doChooseMostSpecificParams, dropMethodCache, dropStaticMethodCache, findMethodInClassHierarchy, findMixinMethod, findOwnMethod, findPropertyInClassHierarchy, getAdditionalMetaMethods, getAttribute, getAttribute, getAttribute, getClassInfo, getClassNode, getEffectiveGetMetaProperty, getMetaMethod, getMetaMethods, getMetaProperty, getMethods, getMethodWithCaching, getMethodWithoutCaching, getProperties, getProperty, getRegistry, getStaticMetaMethod, getSubclassMetaMethods, getSuperClasses, getTheCachedClass, getTheClass, getVersion, handleMatches, hasCustomInvokeMethod, hasCustomStaticInvokeMethod, hasProperty, incVersion, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMissingProperty, isGroovyObject, isInitialized, isModified, isPermissivePropertyAccess, onGetPropertyFoundInHierarchy, onInvokeMethodFoundInHierarchy, onMixinMethodFound, onSetPropertyFoundInHierarchy, onSuperMethodFoundInHierarchy, onSuperPropertyFoundInHierarchy, pickMethod, reinitialize, respondsTo, respondsTo, retrieveConstructor, retrieveConstructor, retrieveStaticMethod, selectConstructorAndTransformArguments, setAttribute, setAttribute, setInitialized, setPermissivePropertyAccess, setProperties, setProperty, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.MetaClass
getAttribute, getClassNode, getMetaMethods, getMethods, getProperties, invokeMissingMethod, invokeMissingProperty, pickMethod, selectConstructorAndTransformArguments, setAttributeMethods inherited from interface groovy.lang.MetaObjectProtocol
getAttribute, getMetaMethod, getMetaProperty, getProperty, getStaticMetaMethod, getTheClass, hasProperty, invokeMethod, respondsTo, respondsTo, setAttribute, setProperty
-
Field Details
-
interceptConstruction
public final boolean interceptConstruction
-
-
Constructor Details
-
MockProxyMetaClass
public MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, java.lang.Class theClass, groovy.lang.MetaClass adaptee)- Parameters:
adaptee- the MetaClass to decorate with interceptability
-
MockProxyMetaClass
public MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, java.lang.Class theClass, groovy.lang.MetaClass adaptee, boolean interceptConstruction)- Parameters:
adaptee- the MetaClass to decorate with interceptability
-
-
Method Details
-
make
convenience factory method for the most usual case. -
make
convenience factory method allowing interceptConstruction to be set. -
invokeMethod
public java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)- Specified by:
invokeMethodin interfacegroovy.lang.MetaObjectProtocol- Overrides:
invokeMethodin classgroovy.lang.ProxyMetaClass
-
invokeMethod
public java.lang.Object invokeMethod(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)- Specified by:
invokeMethodin interfacegroovy.lang.MetaClass- Overrides:
invokeMethodin classgroovy.lang.ProxyMetaClass
-
invokeStaticMethod
public java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)- Specified by:
invokeStaticMethodin interfacegroovy.lang.MetaObjectProtocol- Overrides:
invokeStaticMethodin classgroovy.lang.ProxyMetaClass
-
getProperty
public java.lang.Object getProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, boolean b, boolean b1)- Specified by:
getPropertyin interfacegroovy.lang.MetaClass- Overrides:
getPropertyin classgroovy.lang.ProxyMetaClass
-
setProperty
public void setProperty(java.lang.Class aClass, java.lang.Object object, java.lang.String property, java.lang.Object newValue, boolean b, boolean b1)- Specified by:
setPropertyin interfacegroovy.lang.MetaClass- Overrides:
setPropertyin classgroovy.lang.ProxyMetaClass
-
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.- Specified by:
invokeConstructorin interfacegroovy.lang.MetaObjectProtocol- Overrides:
invokeConstructorin classgroovy.lang.ProxyMetaClass
-