Package: groovy.mock.interceptor

## [Java] Class MockProxyMetaClass

- groovy.mock.interceptor.MockProxyMetaClass

-     public class MockProxyMetaClass
      extends ProxyMetaClass

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `boolean` | `interceptConstruction` | Indicates whether constructor invocations should be intercepted.

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class ProxyMetaClass` | `adaptee, interceptor`
    `class MetaClassImpl` | `EMPTY_ARGUMENTS, INVOKE_METHOD_METHOD, METHOD_MISSING, PROPERTY_MISSING, STATIC_METHOD_MISSING, STATIC_PROPERTY_MISSING, getPropertyMethod, invokeMethodMethod, isGroovyObject, isMap, metaMethodIndex, registry, setPropertyMethod, theCachedClass, theClass`

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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.
    `` | `public Object` | `invokeConstructor(Object[] arguments)` Intercepts or delegates constructor invocation depending on interceptConstruction.
    `` | `public Object` | `invokeMethod(Object object, String methodName, Object[] arguments)` Intercepts an instance method invocation and delegates to the adaptee when requested.
    `` | `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.
    `` | `public Object` | `invokeStaticMethod(Object object, String methodName, Object[] arguments)` Intercepts a static method invocation and delegates to the adaptee when requested.
    `` | `public static MockProxyMetaClass` | `make(Class theClass)` convenience factory method for the most usual case.
    `` | `public static MockProxyMetaClass` | `make(Class theClass, boolean interceptConstruction)` convenience factory method allowing interceptConstruction to be set.
    `` | `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.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ProxyMetaClass` | `getAdaptee, getInstance, getInterceptor, getProperty, initialize, invokeConstructor, invokeMethod, invokeMethod, invokeStaticMethod, setAdaptee, setInterceptor, setProperty, use, use`
    `class 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, getMethodWithCaching, getMethodWithoutCaching, getMethods, getNonClosureOuter, getProperties, getProperty, getProperty, getRegistry, getStaticMetaMethod, getSubclassMetaMethods, getSuperClasses, getTheCachedClass, getTheClass, getVersion, handleMatches, hasCustomInvokeMethod, hasCustomStaticInvokeMethod, hasProperty, incVersion, initialize, invokeConstructor, invokeMethod, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, 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, setProperty, toString`

- - ### Field Detail

    - #### public final boolean interceptConstruction

      Indicates whether constructor invocations should be intercepted.

  - ### Constructor Detail

    - #### public MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee)

      Parameters:
        `adaptee` - the MetaClass to decorate with interceptability

    - #### public MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee, boolean interceptConstruction)

      Parameters:
        `adaptee` - the MetaClass to decorate with interceptability

  - ### Method Detail

    - #### 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.

      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

    - #### public Object invokeConstructor(Object[] arguments)

      Intercepts or delegates constructor invocation depending on interceptConstruction.

      Parameters:
        `arguments` - the constructor arguments
      Returns:
        the constructed instance or interceptor-supplied replacement

    - #### public Object invokeMethod(Object object, String methodName, Object[] arguments)

      Intercepts an instance method invocation and delegates to the adaptee when requested.

      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

    - #### 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.

      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

    - #### public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)

      Intercepts a static method invocation and delegates to the adaptee when requested.

      Parameters:
        `object` - the static receiver
        `methodName` - the method name
        `arguments` - the invocation arguments
      Returns:
        the interceptor result or the adaptee result when falling through

    - #### public static MockProxyMetaClass make(Class theClass)

      convenience factory method for the most usual case.

    - #### public static MockProxyMetaClass make(Class theClass, boolean interceptConstruction)

      convenience factory method allowing interceptConstruction to be set.

    - #### 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.

      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