Class MockProxyMetaClass

    • Field Detail

      • interceptConstruction

        public final boolean interceptConstruction
    • Constructor Detail

      • 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 Detail

      • 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​(Class sender,
                                   Object object,
                                   String methodName,
                                   Object[] arguments,
                                   boolean isCallToSuper,
                                   boolean fromInsideClass)
        Description copied from class: ProxyMetaClass
        Call 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:
        invokeMethod in interface MetaClass
        Overrides:
        invokeMethod in 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:
        MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)
      • invokeStaticMethod

        public Object invokeStaticMethod​(Object object,
                                         String methodName,
                                         Object[] arguments)
        Description copied from class: ProxyMetaClass
        Call 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:
        invokeStaticMethod in interface MetaObjectProtocol
        Overrides:
        invokeStaticMethod in 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:
        MissingMethodException
      • getProperty

        public Object getProperty​(Class aClass,
                                  Object object,
                                  String property,
                                  boolean b,
                                  boolean b1)
        Description copied from class: ProxyMetaClass
        Interceptors the call to getProperty if a PropertyAccessInterceptor is available
        Specified by:
        getProperty in interface MetaClass
        Overrides:
        getProperty in 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
      • setProperty

        public void setProperty​(Class aClass,
                                Object object,
                                String property,
                                Object newValue,
                                boolean b,
                                boolean b1)
        Description copied from class: ProxyMetaClass
        Interceptors the call to a property setter if a PropertyAccessInterceptor is available
        Specified by:
        setProperty in interface MetaClass
        Overrides:
        setProperty in 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.
      • invokeConstructor

        public Object invokeConstructor​(Object[] arguments)
        Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.
        Specified by:
        invokeConstructor in interface MetaObjectProtocol
        Overrides:
        invokeConstructor in class ProxyMetaClass
        Parameters:
        arguments - The arguments to the constructor
        Returns:
        An instance of the java.lang.Class that this MetaObjectProtocol object applies to