Class StaticMetaMethodSite
java.lang.Object
org.codehaus.groovy.runtime.callsite.AbstractCallSite
org.codehaus.groovy.runtime.callsite.MetaClassSite
org.codehaus.groovy.runtime.callsite.MetaMethodSite
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite
- All Implemented Interfaces:
CallSite
- Direct Known Subclasses:
StaticMetaMethodSite.StaticMetaMethodSiteNoUnwrap,StaticMetaMethodSite.StaticMetaMethodSiteNoUnwrapNoCoerce
POJO call site
metaclass - cached
method - cached
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCall site where we know there is no need to unwrap argumentsstatic classCall site where we know there is no need neither unwrap nor coerce arguments -
Field Summary
Fields inherited from class org.codehaus.groovy.runtime.callsite.MetaMethodSite
paramsFields inherited from class org.codehaus.groovy.runtime.callsite.MetaClassSite
metaClassFields inherited from class org.codehaus.groovy.runtime.callsite.AbstractCallSite
array, index, name -
Constructor Summary
ConstructorsConstructorDescriptionStaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params) CachesmetaClass,metaMethod, andparams, and recordsmetaClass's version forcheckCall(Object, Object[]). -
Method Summary
Modifier and TypeMethodDescriptionWhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]).callStatic(Class receiver, Object[] args) WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]).protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty.protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object)matches the cached parameter class toarg1.protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object[])matches the cached parameter classes toargs.protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object)matches the cached parameter classes toarg1andarg2.protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matches the cached parameter classes toarg1,arg2, andarg3.protected final booleanReturnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matches the cached parameter classes toarg1througharg4.static CallSitecreateStaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Chooses a static site fromargs.UnwrapsargswithMetaClassHelper.unwrap(Object[])and callsMetaMethod.doMethodInvoke(Object, Object[]), which coerces them.Methods inherited from class org.codehaus.groovy.runtime.callsite.AbstractCallSite
acceptGetProperty, acceptGroovyObjectGetProperty, call, call, call, call, call, callConstructor, callConstructor, callConstructor, callConstructor, callConstructor, callConstructor, callCurrent, callCurrent, callCurrent, callCurrent, callCurrent, callCurrent, callGetProperty, callGetPropertySafe, callGroovyObjectGetProperty, callGroovyObjectGetPropertySafe, callSafe, callSafe, callSafe, callSafe, callSafe, callSafe, callStatic, callStatic, callStatic, callStatic, callStatic, createGetPropertySite, createGroovyObjectGetPropertySite, getArray, getIndex, getName, getProperty
-
Constructor Details
-
StaticMetaMethodSite
public StaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params) CachesmetaClass,metaMethod, andparams, and recordsmetaClass's version forcheckCall(Object, Object[]).
-
-
Method Details
-
invoke
UnwrapsargswithMetaClassHelper.unwrap(Object[])and callsMetaMethod.doMethodInvoke(Object, Object[]), which coerces them. AGroovyRuntimeExceptionis rethrown viaScriptBytecodeAdapter.unwrap(GroovyRuntimeException). Performs no receiver, meta-class version, or argument-class check.- Throws:
Throwable
-
checkCall
Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object[])matches the cached parameter classes toargs. -
checkCall
Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty. -
checkCall
Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object)matches the cached parameter class toarg1. -
checkCall
Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object)matches the cached parameter classes toarg1andarg2. -
checkCall
Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matches the cached parameter classes toarg1,arg2, andarg3. -
checkCall
protected final boolean checkCall(Object receiver, Object arg1, Object arg2, Object arg3, Object arg4) Returnstruewhenreceiveris the meta-class's class, the meta-class version is still the version recorded at construction, andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matches the cached parameter classes toarg1througharg4. -
call
WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]). AGroovyRuntimeExceptionfrom that call is rethrown viaScriptBytecodeAdapter.unwrap(GroovyRuntimeException). Otherwise falls back toCallSiteArray.defaultCall(CallSite, Object, Object[]).- Specified by:
callin interfaceCallSite- Overrides:
callin classAbstractCallSite- Parameters:
receiver- the target of the callargs- the arguments, in order- Returns:
- the value returned by the method
- Throws:
Throwable- when the call fails
-
callStatic
WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]). Otherwise falls back toCallSiteArray.defaultCallStatic(CallSite, Class, Object[]).- Specified by:
callStaticin interfaceCallSite- Overrides:
callStaticin classAbstractCallSite- Parameters:
receiver- the class that declares the methodargs- the arguments, in order- Returns:
- the value returned by the method
- Throws:
Throwable- when the call fails
-
createStaticMetaMethodSite
public static CallSite createStaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Chooses a static site fromargs. WhenParameterTypes.correctArguments(Object[])returns the same array andnoWrappers(args)is true: ifnoCoerceis true, returns aStaticMetaMethodSite.StaticMetaMethodSiteNoUnwrap(itsinvokecallsMetaMethod.doMethodInvoke(Object, Object[])and skipsMetaClassHelper.unwrap(Object[])); ifnoCoerceis false andmetaMethod's class is exactlyCachedMethod, delegates toCachedMethodCallSites.createStaticMetaMethodSite(CachedMethod, CallSite, MetaClassImpl, Class[]); otherwise returns aStaticMetaMethodSite.StaticMetaMethodSiteNoUnwrapNoCoerce(itsinvokecallsMetaMethod.invoke(Object, Object[])with no unwrap and no coerce). If those argument checks fail, returns aStaticMetaMethodSite.
-