Package groovy.mock.interceptor
Class MockProxyMetaClass
- java.lang.Object
-
- groovy.lang.MetaClassImpl
-
- groovy.lang.ProxyMetaClass
-
- groovy.mock.interceptor.MockProxyMetaClass
-
- All Implemented Interfaces:
groovy.lang.AdaptingMetaClass
,groovy.lang.MetaClass
,groovy.lang.MetaObjectProtocol
,groovy.lang.MutableMetaClass
public class MockProxyMetaClass extends groovy.lang.ProxyMetaClass
The ProxyMetaClass for the MockInterceptor. Instance and class methods are intercepted, but constructors are not to allow mocking of aggregated objects.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
interceptConstruction
-
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(groovy.lang.MetaClassRegistry registry, Class theClass, groovy.lang.MetaClass adaptee)
MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, Class theClass, groovy.lang.MetaClass adaptee, boolean interceptConstruction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getProperty(Class aClass, Object object, String property, boolean b, boolean b1)
Object
invokeConstructor(Object[] arguments)
Unlike general impl in superclass, ctors are not intercepted but relayed unless interceptConstruction is set.Object
invokeMethod(Object object, String methodName, Object[] arguments)
Object
invokeStaticMethod(Object object, String methodName, Object[] arguments)
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)
-
Methods inherited from class groovy.lang.ProxyMetaClass
getAdaptee, getInstance, getInterceptor, initialize, invokeMethod, 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, 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, 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
-
-
-
-
Constructor Detail
-
MockProxyMetaClass
public MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, Class theClass, groovy.lang.MetaClass adaptee)
- Parameters:
adaptee
- the MetaClass to decorate with interceptability
-
MockProxyMetaClass
public MockProxyMetaClass(groovy.lang.MetaClassRegistry registry, Class theClass, groovy.lang.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(Object object, String methodName, Object[] arguments)
- Specified by:
invokeMethod
in interfacegroovy.lang.MetaObjectProtocol
- Overrides:
invokeMethod
in classgroovy.lang.ProxyMetaClass
-
invokeStaticMethod
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)
- Specified by:
invokeStaticMethod
in interfacegroovy.lang.MetaObjectProtocol
- Overrides:
invokeStaticMethod
in classgroovy.lang.ProxyMetaClass
-
getProperty
public Object getProperty(Class aClass, Object object, String property, boolean b, boolean b1)
- Specified by:
getProperty
in interfacegroovy.lang.MetaClass
- Overrides:
getProperty
in classgroovy.lang.ProxyMetaClass
-
setProperty
public void setProperty(Class aClass, Object object, String property, Object newValue, boolean b, boolean b1)
- Specified by:
setProperty
in interfacegroovy.lang.MetaClass
- Overrides:
setProperty
in classgroovy.lang.ProxyMetaClass
-
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 interfacegroovy.lang.MetaObjectProtocol
- Overrides:
invokeConstructor
in classgroovy.lang.ProxyMetaClass
-
-