Package org.codehaus.groovy.runtime
Class IteratorClosureAdapter<T>
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Closure
org.codehaus.groovy.runtime.IteratorClosureAdapter<T>
- All Implemented Interfaces:
GroovyCallable,GroovyObject,Serializable,Cloneable,Runnable,Callable
A closure which stores calls in a List so that method calls
can be iterated over in a 'yield' style way
- See Also:
-
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
ConstructorsConstructorDescriptionIteratorClosureAdapter(Object delegate) Creates an adapter whose owner isdelegate. -
Method Summary
Modifier and TypeMethodDescriptionasList()Returns the values passed todoCall(T), in call order.protected ObjectAppendsargumentto the list returned byasList().Returns the metaclass for a given class.voidsetMetaClass(MetaClass metaClass) Allows the MetaClass to be replaced with a derived implementation.Methods inherited from class groovy.lang.Closure
additionalReferences, andThen, andThenSelf, andThenSelf, asWritable, call, call, 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, rehydrate, rightShift, run, setDelegate, setDirective, setProperty, setResolveStrategy, throwRuntimeException, trampoline, trampolineMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
invokeMethod
-
Constructor Details
-
IteratorClosureAdapter
Creates an adapter whose owner isdelegate. Calls are collected in a list that starts empty.- Parameters:
delegate- closure owner
-
-
Method Details
-
getMetaClass
Description copied from class:GroovyObjectSupportReturns the metaclass for a given class.- Specified by:
getMetaClassin interfaceGroovyObject- Overrides:
getMetaClassin classGroovyObjectSupport- Returns:
- the metaClass of this instance
-
setMetaClass
Description copied from class:GroovyObjectSupportAllows the MetaClass to be replaced with a derived implementation.- Specified by:
setMetaClassin interfaceGroovyObject- Overrides:
setMetaClassin classClosure- Parameters:
metaClass- the new metaclass
-
asList
Returns the values passed todoCall(T), in call order. Later calls append to the same list.- Returns:
- the accumulated values
-
doCall
Appendsargumentto the list returned byasList().- Parameters:
argument- value yielded by one call- Returns:
null
-