Package groovy.mock.interceptor
Class MockProxyMetaClass
java.lang.Object
groovy.lang.MetaClassImpl
groovy.lang.ProxyMetaClass
groovy.mock.interceptor.MockProxyMetaClass
- All Implemented Interfaces:
- AdaptingMetaClass,- MetaClass,- MetaObjectProtocol,- MutableMetaClass
The ProxyMetaClass for the MockInterceptor.
 Instance and class methods are intercepted, but constructors are not to allow mocking of aggregated objects.
- 
Nested Class SummaryNested classes/interfaces inherited from class groovy.lang.MetaClassImplMetaClassImpl.MetaConstructor
- 
Field SummaryFieldsFields inherited from class groovy.lang.ProxyMetaClassadaptee, interceptorFields inherited from class groovy.lang.MetaClassImplEMPTY_ARGUMENTS, getPropertyMethod, INVOKE_METHOD_METHOD, invokeMethodMethod, isGroovyObject, isMap, metaMethodIndex, METHOD_MISSING, PROPERTY_MISSING, registry, setPropertyMethod, STATIC_METHOD_MISSING, STATIC_PROPERTY_MISSING, theCachedClass, theClass
- 
Constructor SummaryConstructorsConstructorDescriptionMockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee) MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee, boolean interceptConstruction) 
- 
Method SummaryModifier and TypeMethodDescriptiongetProperty(Class aClass, Object object, String property, boolean b, boolean b1) Interceptors the call to getProperty if a PropertyAccessInterceptor is availableinvokeConstructor(Object[] arguments) Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.invokeMethod(Class sender, Object object, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass) Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.invokeMethod(Object object, String methodName, Object[] arguments) Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.invokeStaticMethod(Object object, String methodName, Object[] arguments) Call invokeStaticMethod on adaptee with logic like in MetaClass unless we have an Interceptor.static MockProxyMetaClassconvenience factory method for the most usual case.static MockProxyMetaClassconvenience factory method allowing interceptConstruction to be set.voidsetProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1) Interceptors the call to a property setter if a PropertyAccessInterceptor is availableMethods inherited from class groovy.lang.ProxyMetaClassgetAdaptee, getInstance, getInterceptor, initialize, setAdaptee, setInterceptor, use, useMethods inherited from class groovy.lang.MetaClassImpladdMetaBeanProperty, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.MetaClassgetAttribute, getClassNode, getMetaMethods, getMethods, getProperties, invokeMissingMethod, invokeMissingProperty, pickMethod, selectConstructorAndTransformArguments, setAttributeMethods inherited from interface groovy.lang.MetaObjectProtocolgetAttribute, getMetaMethod, getMetaProperty, getProperty, getStaticMetaMethod, getTheClass, hasProperty, invokeMethod, respondsTo, respondsTo, setAttribute, setProperty
- 
Field Details- 
interceptConstructionpublic final boolean interceptConstruction
 
- 
- 
Constructor Details- 
MockProxyMetaClass- Parameters:
- adaptee- the MetaClass to decorate with interceptability
 
- 
MockProxyMetaClasspublic MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee, boolean interceptConstruction) - Parameters:
- adaptee- the MetaClass to decorate with interceptability
 
 
- 
- 
Method Details- 
makeconvenience factory method for the most usual case.
- 
makeconvenience factory method allowing interceptConstruction to be set.
- 
invokeMethodDescription copied from class:ProxyMetaClassCall 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.- Specified by:
- invokeMethodin interface- MetaObjectProtocol
- Overrides:
- invokeMethodin class- ProxyMetaClass
- Parameters:
- object- The object which the method was invoked on
- methodName- The name of the method
- arguments- The arguments to the method
- Returns:
- The return value of the method
- See Also:
 
- 
invokeMethodpublic Object invokeMethod(Class sender, Object object, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass) Description copied from class:ProxyMetaClassCall 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.- Specified by:
- invokeMethodin interface- MetaClass
- Overrides:
- invokeMethodin class- ProxyMetaClass
- Parameters:
- sender- The java.lang.Class instance that invoked the method
- object- The object which the method was invoked on
- methodName- The name of the method
- arguments- The arguments to the method
- isCallToSuper- Whether the method is a call to a super class method
- fromInsideClass- Whether the call was invoked from the inside or the outside of the class
- Returns:
- The return value of the method.
- See Also:
 
- 
invokeStaticMethodDescription copied from class:ProxyMetaClassCall 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.- Specified by:
- invokeStaticMethodin interface- MetaObjectProtocol
- Overrides:
- invokeStaticMethodin class- ProxyMetaClass
- Parameters:
- object- An instance of the class returned by the getTheClass() method or the class itself
- methodName- The name of the method
- arguments- The arguments to the method
- Returns:
- The return value of the method which is null if the return type is void
- See Also:
 
- 
getPropertyDescription copied from class:ProxyMetaClassInterceptors the call to getProperty if a PropertyAccessInterceptor is available- Specified by:
- getPropertyin interface- MetaClass
- Overrides:
- getPropertyin class- ProxyMetaClass
- Parameters:
- aClass- The java.lang.Class instance that requested the property
- object- the object to invoke the getter on
- property- the property name
- b- Whether the call is to a super class property
- b1- ??
- Returns:
- the value of the property
 
- 
setPropertypublic void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1) Description copied from class:ProxyMetaClassInterceptors the call to a property setter if a PropertyAccessInterceptor is available- Specified by:
- setPropertyin interface- MetaClass
- Overrides:
- setPropertyin class- ProxyMetaClass
- Parameters:
- aClass- The java.lang.Class instance that is mutating the property
- object- The object to invoke the setter on
- property- The property name to set
- newValue- The new value of the property
- b- Whether the call is to a super class property
- b1- Whether the call was invoked from the inside or the outside of the class.
 
- 
invokeConstructorUnlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.- Specified by:
- invokeConstructorin interface- MetaObjectProtocol
- Overrides:
- invokeConstructorin class- ProxyMetaClass
- Parameters:
- arguments- The arguments to the constructor
- Returns:
- An instance of the java.lang.Class that this MetaObjectProtocol object applies to
 
 
-