public class BooleanClosureWrapper
extends java.lang.Object
Closure
and
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
in DefaultTypeTransformation.castToBoolean(Object)
. The purpose of
this class is to avoid the slow "asBoolean" call in that method.
BooleanReturningMethodInvoker
is used for caching.Constructor and Description |
---|
BooleanClosureWrapper(Closure wrapped) |
Modifier and Type | Method and Description |
---|---|
boolean |
call(java.lang.Object... args)
normal closure call
|
<K,V> boolean |
callForMap(java.util.Map.Entry<K,V> entry)
Bridge for a call based on a map entry.
|
public BooleanClosureWrapper(Closure wrapped)
public boolean call(java.lang.Object... args)
public <K,V> boolean callForMap(java.util.Map.Entry<K,V> entry)
Closure
taking one argument, then we give in the Map.Entry
, otherwise we will
give in the key and value.