groovy.mock.interceptor
Class MockProxyMetaClass

java.lang.Object
  extended by groovy.lang.MetaClass
      extended by groovy.lang.MetaClassImpl
          extended by groovy.lang.ProxyMetaClass
              extended by groovy.mock.interceptor.MockProxyMetaClass

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.

Author:
Dierk Koenig

Field Summary
 
Fields inherited from class groovy.lang.ProxyMetaClass
adaptee, interceptor
 
Fields inherited from class groovy.lang.MetaClassImpl
registry
 
Fields inherited from class groovy.lang.MetaClass
log, NO_METHOD_FOUND, theClass, useReflection
 
Constructor Summary
MockProxyMetaClass(MetaClassRegistry registry, Class theClass, MetaClass adaptee)
           
 
Method Summary
 Object invokeConstructor(Object[] arguments)
          Unlike general impl in superclass, ctors are not intercepted but relayed
 Object invokeMethod(Object object, String methodName, Object[] arguments)
          Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.
 Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
          Call invokeStaticMethod on adaptee with logic like in MetaClass unless we have an Interceptor.
static MockProxyMetaClass make(Class theClass)
          convenience factory method for the most usual case.
 
Methods inherited from class groovy.lang.ProxyMetaClass
getInstance, getInterceptor, setInterceptor, use, use
 
Methods inherited from class groovy.lang.MetaClassImpl
addMetaMethod, addNewInstanceMethod, addNewStaticMethod, cacheInstanceMethod, cacheStaticMethod, checkInitalised, clearInvocationCaches, getAttribute, getAttribute, getClassNode, getMetaMethods, getMethods, getProperties, getProperty, getProperty, initialize, invokeMethod, isInitialized, pickMethod, pickMethod, retrieveConstructor, retrieveMethod, retrieveMethod, retrieveStaticMethod, selectConstructorAndTransformArguments, setAttribute, setAttribute, setProperties, setProperty, setProperty, toString
 
Methods inherited from class groovy.lang.MetaClass
getAttribute, invokeConstructorAt, invokeMethod, invokeMissingMethod, isGroovyObject, isUseReflection, setUseReflection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockProxyMetaClass

public MockProxyMetaClass(MetaClassRegistry registry,
                          Class theClass,
                          MetaClass adaptee)
                   throws IntrospectionException
Parameters:
adaptee - the MetaClass to decorate with interceptability
Throws:
IntrospectionException
Method Detail

make

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

Throws:
IntrospectionException

invokeMethod

public Object invokeMethod(Object object,
                           String methodName,
                           Object[] arguments)
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.

Overrides:
invokeMethod in class ProxyMetaClass

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.

Overrides:
invokeStaticMethod in class ProxyMetaClass

invokeConstructor

public Object invokeConstructor(Object[] arguments)
Unlike general impl in superclass, ctors are not intercepted but relayed

Overrides:
invokeConstructor in class ProxyMetaClass


Copyright © 2003-2009 The Codehaus. All Rights Reserved.