Groovy Documentation

## org.codehaus.groovy.runtime.callsite
[Java] Class BooleanReturningMethodInvoker

    java.lang.Object
      org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker

    public class BooleanReturningMethodInvoker
    extends java.lang.Object

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 DefaultTypeTransformation.castToBoolean. 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.

Authors:
  Jochen "blackdrag" Theodorou

Constructor Summary
`BooleanReturningMethodInvoker()`
`BooleanReturningMethodInvoker(java.lang.String methodName)`

Method Summary
`boolean` | `convertToBoolean(java.lang.Object arg)`
`boolean` | `invoke(java.lang.Object receiver, java.lang.Object... args)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### BooleanReturningMethodInvoker

    public BooleanReturningMethodInvoker()

### BooleanReturningMethodInvoker

    public BooleanReturningMethodInvoker(java.lang.String methodName)

Method Detail

### convertToBoolean

    public boolean convertToBoolean(java.lang.Object arg)

### invoke

    public boolean invoke(java.lang.Object receiver, java.lang.Object... args)

Groovy Documentation