Top Description Fields Constructors Methods
org.codehaus.groovy.runtime.callsite

public Class BooleanReturningMethodInvoker

extends Object
Class Inheritance
Imports
org.apache.groovy.internal.util.UncheckedThrow

Helper class for internal use only. This allows to call a given method and convert the result to a boolean. It will do this by caching the method call 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 org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation#castToBoolean(Object). The purpose of this class is to avoid the slow "asBoolean" call in that method. The nature of this class allows a per instance caching instead of a per class caching like the normal CallSiteArray logic.

Field Summary

Modifier and TypeField and Description
private final CallSiteArray

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
invoke(Object receiver, Object... args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

csaback to summary
private final CallSiteArray csa

Constructor Detail

BooleanReturningMethodInvokerback to summary
public BooleanReturningMethodInvoker()
BooleanReturningMethodInvokerback to summary
public BooleanReturningMethodInvoker(String methodName)

Method Detail

convertToBooleanback to summary
public boolean convertToBoolean(Object arg)
invokeback to summary
public boolean invoke(Object receiver, Object... args)