Class BooleanClosureWrapper
- java.lang.Object
-
- org.codehaus.groovy.runtime.callsite.BooleanClosureWrapper
-
public class BooleanClosureWrapper extends java.lang.ObjectHelper class for internal use only. This allows to call aClosureand convert the result to a boolean. It will do this by caching the possible "doCall" as well as the "asBoolean" in CallSiteArray fashion. "asBoolean" will not be called if the result is null or a Boolean. In case of null we return false and in case of a Boolean we simply unbox. This logic is designed after the one present inDefaultTypeTransformation.castToBoolean(Object). The purpose of this class is to avoid the slow "asBoolean" call in that method.BooleanReturningMethodInvokeris used for caching.
-
-
Constructor Summary
Constructors Constructor Description BooleanClosureWrapper(Closure wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancall(java.lang.Object... args)normal closure call<K,V>
booleancallForMap(java.util.Map.Entry<K,V> entry)Bridge for a call based on a map entry.
-
-
-
Constructor Detail
-
BooleanClosureWrapper
public BooleanClosureWrapper(Closure wrapped)
-
-
Method Detail
-
call
public boolean call(java.lang.Object... args)
normal closure call
-
callForMap
public <K,V> boolean callForMap(java.util.Map.Entry<K,V> entry)
Bridge for a call based on a map entry. If the call is done on aClosuretaking one argument, then we give in theMap.Entry, otherwise we will give in the key and value.
-
-