Class PackedClosure.Fixed4
- All Implemented Interfaces:
GroovyCallable<Object>,GroovyObject,Serializable,Cloneable,Runnable,Callable<Object>,GeneratedClosure
- Enclosing class:
- PackedClosure
doCall takes four arguments and forwards them to PackedClosure.dispatchAll(java.lang.Object[]).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codehaus.groovy.runtime.PackedClosure
PackedClosure.Fixed0, PackedClosure.Fixed1, PackedClosure.Fixed2, PackedClosure.Fixed3, PackedClosure.Fixed4, PackedClosure.FixedIt, PackedClosure.FixedN -
Field Summary
Fields inherited from class groovy.lang.Closure
DELEGATE_FIRST, DELEGATE_ONLY, DONE, IDENTITY, maximumNumberOfParameters, OWNER_FIRST, OWNER_ONLY, parameterTypes, SKIP, TO_SELF -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.codehaus.groovy.runtime.PackedClosure
call, call, create, create, dispatchAll, rehydrate, setDelegate, setResolveStrategy, toStringMethods inherited from class groovy.lang.Closure
additionalReferences, andThen, andThenSelf, andThenSelf, asWritable, call, checkForReferenceCycle, clone, compose, composeSelf, composeSelf, curry, curry, dehydrate, getDelegate, getDirective, getMaximumNumberOfParameters, getOwner, getParameterTypes, getProperty, getResolveStrategy, getThisObject, isCase, leftShift, leftShift, memoize, memoizeAtLeast, memoizeAtMost, memoizeBetween, mopUnperturbed, ncurry, ncurry, rcurry, rcurry, rightShift, run, setDirective, setMetaClass, setProperty, throwRuntimeException, trampoline, trampolineMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClassMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
invokeMethod
-
Constructor Details
-
Fixed4
public Fixed4(Object owner, GeneratedDispatcher.Bundle dispatchers, int id, String method, Object[] captured, Class[] visibleTypes, boolean strict) Initializes the four-parameter packed closure.doCall(Object, Object, Object, Object)copies the four values into an array and passes that array toPackedClosure.dispatchAll(java.lang.Object[]).The arguments are forwarded to
PackedClosure.owneris stored as the closure owner, the delegate, and thethisobject, and as the receiver each later dispatch passes to the hoisted method. The general, one-value, and two-value dispatchers are taken fromdispatchers.idandmethodare stored.capturedis kept by reference, and a null array is replaced with an empty one.Closurefirst fills the parameter metadata by reflecting this member'sdoCall; that metadata is then replaced byvisibleTypes, which is also kept by reference.- Parameters:
owner- the object stored as the closure owner, the delegate, and thethisobject, and as the receiver passed to the hoisted method. A static hoisted method is given the enclosing classdispatchers- the hosting class'sGeneratedDispatchertables. The general, one-value, and two-value dispatchers are read from this bundleid- index of the hoisted method in those tablesmethod- name of the hoisted method, kept for diagnosticscaptured- values closed over from the enclosing scope and passed ahead of the call arguments.nullis stored as an empty array; a non-null array is retained by referencevisibleTypes- declared parameter types, retained by reference and installed as this closure's parameter metadata in place of the types reflected fromdoCallstrict- value stored for the delegate and resolve-strategy guards.truemakes a non-null delegate other than the owner, or a strategy other than owner-first or owner-only, fail when it is set
-
-
Method Details
-
doCall
Copies the four arguments into a new array and dispatches that list.When the stored parameter count is four, each value is coerced to the matching parameter type and packed with the receiver and the captured values for the general dispatcher. A different stored count is adapted by
PackedClosure.dispatchAll(java.lang.Object[]). An argument list that still does not fit, or a value that cannot be coerced, raisesMissingMethodException. An exception thrown by the hoisted method propagates to the caller.- Parameters:
a- value supplied for the first parameterb- value supplied for the second parameterc- value supplied for the third parameterd- value supplied for the fourth parameter- Returns:
- the value returned by the hoisted method, or
nullwhen that method is void
-