[Java] Class BooleanReturningMethodInvoker
- org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker
public class BooleanReturningMethodInvoker extends 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.
Constructor Summary
Constructor and description |
---|
BooleanReturningMethodInvoker
() |
BooleanReturningMethodInvoker
(String methodName) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public boolean |
convertToBoolean(Object arg) | |
public boolean |
invoke(Object receiver, Object args) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail
public BooleanReturningMethodInvoker()
public BooleanReturningMethodInvoker(String methodName)
Method Detail
public boolean convertToBoolean(Object arg)
public boolean invoke(Object receiver, Object args)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/runtime/callsite/BooleanReturningMethodInvoker.html