Class PogoMetaMethodSite
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.PlainObjectMetaMethodSite
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite
- All Implemented Interfaces:
CallSite
- Direct Known Subclasses:
PogoMetaMethodSite.PogoCachedMethodSite,PogoMetaMethodSite.PogoMetaMethodSiteNoUnwrap,PogoMetaMethodSite.PogoMetaMethodSiteNoUnwrapNoCoerce
POGO call site
metaclass - cached
method - cached
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPOGO site that invokes a reflectedMethod.static classReflected POGO site that skipsMetaClassHelper.unwrap(Object[]).static classReflected POGO site that skips bothMetaClassHelper.unwrap(Object[])andParameterTypes.coerceArgumentsToClasses(Object[]).static 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
ConstructorsConstructorDescriptionPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params) CachesmetaClass,metaMethod, andparams, recordsmetaClass's version, and skips later version checks whenmetaClass's class is exactlyMetaClassImpl. -
Method Summary
Modifier and TypeMethodDescriptionWhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]).callCurrent(GroovyObject receiver, Object[] args) WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]).protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty.protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object)matchesarg1.protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object[])matchesargs.protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object)matchesarg1andarg2.protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matchesarg1,arg2, andarg3.protected booleanReturnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matchesarg1througharg4.static CallSitecreateCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod metaMethod, Class[] params, Object[] args) Chooses aCachedMethodPOGO site fromargs.static CallSitecreatePogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Returns a POGO site formetaMethod.UnwrapsargswithMetaClassHelper.unwrap(Object[])and callsMetaMethod.doMethodInvoke(Object, Object[]), which coerces them.Methods inherited from class org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite
doInvokeMethods 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, callGetProperty, callGetPropertySafe, callGroovyObjectGetProperty, callGroovyObjectGetPropertySafe, callSafe, callSafe, callSafe, callSafe, callSafe, callSafe, callStatic, callStatic, callStatic, callStatic, callStatic, callStatic, createGetPropertySite, createGroovyObjectGetPropertySite, getArray, getIndex, getName, getProperty
-
Constructor Details
-
PogoMetaMethodSite
public PogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params) CachesmetaClass,metaMethod, andparams, recordsmetaClass's version, and skips later version checks whenmetaClass's class is exactlyMetaClassImpl.
-
-
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
-
callCurrent
WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]). AGroovyRuntimeExceptionfrom that call is rethrown viaScriptBytecodeAdapter.unwrap(GroovyRuntimeException). Otherwise falls back toCallSiteArray.defaultCallCurrent(CallSite, GroovyObject, Object[]).- Specified by:
callCurrentin interfaceCallSite- Overrides:
callCurrentin classAbstractCallSite- Parameters:
receiver- the current Groovy objectargs- the arguments, in order- Returns:
- the value returned by the method
- Throws:
Throwable- when the call fails
-
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
-
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object[])matchesargs. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object)matchesarg1. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object)matchesarg1andarg2. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matchesarg1,arg2, andarg3. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
checkCall
Returnstruewhen the current thread has no Groovy category,receiveris aGroovyObjectwhose meta-class is this site's meta-class, the recorded meta-class version still matches (skipped when the meta-class's class is exactlyMetaClassImpl), andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matchesarg1througharg4. Anullreceiver or a receiver that is not aGroovyObjectreturnsfalse. Any otherNullPointerExceptionorClassCastExceptionis rethrown. -
createPogoMetaMethodSite
public static CallSite createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Returns a POGO site formetaMethod. When its class is exactlyCachedMethod, delegates tocreateCachedMethodSite(org.codehaus.groovy.runtime.callsite.CallSite, groovy.lang.MetaClassImpl, org.codehaus.groovy.reflection.CachedMethod, java.lang.Class[], java.lang.Object[]). Otherwise, whenParameterTypes.correctArguments(Object[])returns the same array andnoWrappers(args)is true, returns aPogoMetaMethodSite.PogoMetaMethodSiteNoUnwrapifnoCoerceis true (itsinvokecallsMetaMethod.doMethodInvoke(Object, Object[])and skipsMetaClassHelper.unwrap(Object[])) and aPogoMetaMethodSite.PogoMetaMethodSiteNoUnwrapNoCoerceifnoCoerceis false (itsinvokecallsMetaMethod.invoke(Object, Object[])with no unwrap and no coerce). If those argument checks fail, returns aPogoMetaMethodSite. -
createCachedMethodSite
public static CallSite createCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod metaMethod, Class[] params, Object[] args) Chooses aCachedMethodPOGO site fromargs. WhenParameterTypes.correctArguments(Object[])returns the same array andnoWrappers(args)is true, returns aPogoMetaMethodSite.PogoCachedMethodSiteNoUnwrapifnoCoerceis true, and otherwise delegates toCachedMethodCallSites.createPogoMetaMethodSite(CachedMethod, CallSite, MetaClassImpl, Class[]). Otherwise returns aPogoMetaMethodSite.PogoCachedMethodSite, whoseinvokeunwraps, coerces, and reflects.
-