Class PojoMetaMethodSite
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.PojoMetaMethodSite
- All Implemented Interfaces:
CallSite
- Direct Known Subclasses:
PojoMetaMethodSite.PojoCachedMethodSite,PojoMetaMethodSite.PojoMetaMethodSiteNoUnwrap,PojoMetaMethodSite.PojoMetaMethodSiteNoUnwrapNoCoerce
POJO call site
metaclass - cached
method - cached
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPOJO site that invokes a reflectedMethod.static classReflected POJO site that skipsMetaClassHelper.unwrap(Object[]).static classReflected POJO 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
FieldsModifier and TypeFieldDescriptionprotected final intMeta-class version recorded by the constructor.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
ConstructorsConstructorDescriptionPojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params) -
Method Summary
Modifier and TypeMethodDescriptionWhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]).protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty.protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object)matches the cached parameter class toarg1.protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object[])matches the cached parameter classes toargs.protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object)matches the cached parameter classes toarg1andarg2.protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matches the cached parameter classes toarg1,arg2, andarg3.protected final booleanReturnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matches the cached parameter classes toarg1througharg4.protected final booleanReturns whether the current thread has no Groovy category andMetaClassImpl.getVersion()is stillversion.static CallSitecreateCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod metaMethod, Class[] params, Object[] args) Chooses aCachedMethodsite fromargs.static CallSitecreateNonAwareCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Chooses aPojoMetaMethodSitefromargs.static CallSitecreatePojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object receiver, Object[] args) Returns a 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, callCurrent, callGetProperty, callGetPropertySafe, callGroovyObjectGetProperty, callGroovyObjectGetPropertySafe, callSafe, callSafe, callSafe, callSafe, callSafe, callSafe, callStatic, callStatic, callStatic, callStatic, callStatic, callStatic, createGetPropertySite, createGroovyObjectGetPropertySite, getArray, getIndex, getName, getProperty
-
Field Details
-
version
protected final int versionMeta-class version recorded by the constructor.checkPojoMetaClass()accepts the site only whileMetaClassImpl.getVersion()is still this value.
-
-
Constructor Details
-
PojoMetaMethodSite
public PojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params)
-
-
Method Details
-
invoke
UnwrapsargswithMetaClassHelper.unwrap(Object[])and callsMetaMethod.doMethodInvoke(Object, Object[]), which coerces them. Performs no receiver, meta-class version, or argument-class check.- Throws:
Throwable
-
call
WhencheckCall(Object, Object[])passes,invoke(Object, Object[])unwrapsargsand callsMetaMethod.doMethodInvoke(Object, Object[]). 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
-
checkPojoMetaClass
protected final boolean checkPojoMetaClass()Returns whether the current thread has no Groovy category andMetaClassImpl.getVersion()is stillversion. -
checkCall
Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object[])matches the cached parameter classes toargs. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
checkCall
Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[])reports that the cached parameter list is empty. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
checkCall
Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object)matches the cached parameter class toarg1. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
checkCall
Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object)matches the cached parameter classes toarg1andarg2. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
checkCall
Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object, Object)matches the cached parameter classes toarg1,arg2, andarg3. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
checkCall
protected final boolean checkCall(Object receiver, Object arg1, Object arg2, Object arg3, Object arg4) Returnstruewhenreceiver's class is the meta-class's class,checkPojoMetaClass()passes, andMetaClassHelper.sameClasses(Class[], Object, Object, Object, Object)matches the cached parameter classes toarg1througharg4. Anullreceiver is checked again asNullObject. Any otherNullPointerExceptionis rethrown. -
createPojoMetaMethodSite
public static CallSite createPojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object receiver, Object[] args) Returns a 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 delegates tocreateNonAwareCallSite(org.codehaus.groovy.runtime.callsite.CallSite, groovy.lang.MetaClassImpl, groovy.lang.MetaMethod, java.lang.Class[], java.lang.Object[]).receiveris unused. -
createCachedMethodSite
public static CallSite createCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod metaMethod, Class[] params, Object[] args) Chooses aCachedMethodsite fromargs. WhenParameterTypes.correctArguments(Object[])returns the same array andnoWrappers(args)is true, returns aPojoMetaMethodSite.PojoCachedMethodSiteNoUnwrapifnoCoerceis true, and otherwise delegates toCachedMethodCallSites.createPojoMetaMethodSite(CachedMethod, CallSite, MetaClassImpl, Class[]). Otherwise returns aPojoMetaMethodSite.PojoCachedMethodSite, whoseinvokeunwraps, coerces, and reflects. -
createNonAwareCallSite
public static CallSite createNonAwareCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object[] args) Chooses aPojoMetaMethodSitefromargs. WhenParameterTypes.correctArguments(Object[])returns the same array andnoWrappers(args)is true, returns aPojoMetaMethodSite.PojoMetaMethodSiteNoUnwrapifnoCoerceis true (itsinvokecallsMetaMethod.doMethodInvoke(Object, Object[])and skipsMetaClassHelper.unwrap(Object[])) and aPojoMetaMethodSite.PojoMetaMethodSiteNoUnwrapNoCoerceifnoCoerceis false (itsinvokecallsMetaMethod.invoke(Object, Object[])with no unwrap and no coerce). Otherwise returns aPojoMetaMethodSite.
-