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`

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.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class groovy.lang.MetaClassImpl

  `MetaClassImpl.MetaConstructor`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final boolean`
  `interceptConstruction`
  Indicates whether constructor invocations should be intercepted.

  ### Fields inherited from class groovy.lang.ProxyMetaClass

  `adaptee, interceptor`

  ### Fields 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(MetaClassRegistry registry, Class theClass, MetaClass adaptee)`
  `MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee, boolean interceptConstruction)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getProperty(Class aClass, Object object, String property, boolean b, boolean b1)`
  Intercepts a property read and delegates to the adaptee when no custom value is supplied.
  `Object`
  `invokeConstructor(Object[] arguments)`
  Intercepts or delegates constructor invocation depending on `interceptConstruction`.
  `Object`
  `invokeMethod(Class sender, Object object, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)`
  Intercepts an instance method invocation with sender metadata and delegates when requested.
  `Object`
  `invokeMethod(Object object, String methodName, Object[] arguments)`
  Intercepts an instance method invocation and delegates to the adaptee when requested.
  `Object`
  `invokeStaticMethod(Object object, String methodName, Object[] arguments)`
  Intercepts a static method invocation and delegates to the adaptee when requested.
  `static MockProxyMetaClass`
  `make(Class theClass)`
  convenience factory method for the most usual case.
  `static MockProxyMetaClass`
  `make(Class theClass, boolean interceptConstruction)`
  convenience factory method allowing interceptConstruction to be set.
  `void`
  `setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1)`
  Intercepts a property write and delegates to the adaptee when no custom handling is supplied.

  ### Methods inherited from class groovy.lang.ProxyMetaClass

  `getAdaptee, getInstance, getInterceptor, initialize, setAdaptee, setInterceptor, use, use`

  ### Methods 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, getNonClosureOuter, 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, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface groovy.lang.MetaClass

  `getAttribute, getClassNode, getMetaMethods, getMethods, getProperties, invokeMissingMethod, invokeMissingProperty, pickMethod, selectConstructorAndTransformArguments, setAttribute`

  ### Methods 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
    Indicates whether constructor invocations should be intercepted.

- ## Constructor Details

  - ### MockProxyMetaClass

    public MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee)
    Parameters:
      `adaptee` - the MetaClass to decorate with interceptability

  - ### MockProxyMetaClass

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

- ## Method Details

  - ### make

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

  - ### make

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

  - ### invokeMethod

    public Object invokeMethod(Object object, String methodName, Object[] arguments)
    Intercepts an instance method invocation and delegates to the adaptee when requested.
    Specified by:
      `invokeMethod` in interface `MetaObjectProtocol`
    Overrides:
      `invokeMethod` in class `ProxyMetaClass`
    Parameters:
      `object` - the receiver of the method call
      `methodName` - the method name
      `arguments` - the invocation arguments
    Returns:
      the interceptor result or the adaptee result when falling through
    See Also:
      - `MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)`

  - ### invokeMethod

    public Object invokeMethod(Class sender, Object object, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)
    Intercepts an instance method invocation with sender metadata and delegates when requested.
    Specified by:
      `invokeMethod` in interface `MetaClass`
    Overrides:
      `invokeMethod` in class `ProxyMetaClass`
    Parameters:
      `sender` - the sender class
      `object` - the receiver of the method call
      `methodName` - the method name
      `arguments` - the invocation arguments
      `isCallToSuper` - whether the call targets a superclass implementation
      `fromInsideClass` - whether the call originates from inside the declaring class
    Returns:
      the interceptor result or the adaptee result when falling through
    See Also:
      - `MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)`

  - ### invokeStaticMethod

    public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
    Intercepts a static method invocation and delegates to the adaptee when requested.
    Specified by:
      `invokeStaticMethod` in interface `MetaObjectProtocol`
    Overrides:
      `invokeStaticMethod` in class `ProxyMetaClass`
    Parameters:
      `object` - the static receiver
      `methodName` - the method name
      `arguments` - the invocation arguments
    Returns:
      the interceptor result or the adaptee result when falling through
    See Also:
      - `MissingMethodException`

  - ### getProperty

    public Object getProperty(Class aClass, Object object, String property, boolean b, boolean b1)
    Intercepts a property read and delegates to the adaptee when no custom value is supplied.
    Specified by:
      `getProperty` in interface `MetaClass`
    Overrides:
      `getProperty` in class `ProxyMetaClass`
    Parameters:
      `aClass` - the dispatch class
      `object` - the receiver of the property access
      `property` - the property name
      `b` - implementation-specific flag forwarded to the adaptee
      `b1` - implementation-specific flag forwarded to the adaptee
    Returns:
      the intercepted or delegated property value

  - ### setProperty

    public void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1)
    Intercepts a property write and delegates to the adaptee when no custom handling is supplied.
    Specified by:
      `setProperty` in interface `MetaClass`
    Overrides:
      `setProperty` in class `ProxyMetaClass`
    Parameters:
      `aClass` - the dispatch class
      `object` - the receiver of the property access
      `property` - the property name
      `newValue` - the value to assign
      `b` - implementation-specific flag forwarded to the adaptee
      `b1` - implementation-specific flag forwarded to the adaptee

  - ### invokeConstructor

    public Object invokeConstructor(Object[] arguments)
    Intercepts or delegates constructor invocation depending on `interceptConstruction`.
    Specified by:
      `invokeConstructor` in interface `MetaObjectProtocol`
    Overrides:
      `invokeConstructor` in class `ProxyMetaClass`
    Parameters:
      `arguments` - the constructor arguments
    Returns:
      the constructed instance or interceptor-supplied replacement