Class BooleanCaster
java.lang.Object
ortus.boxlang.runtime.dynamic.casters.BooleanCaster
- All Implemented Interfaces:
IBoxCaster
I handle casting anything to a boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CastAttempt
<Boolean> Tests to see if the value can be cast to a boolean.static Boolean
Used to cast anything to a boolean, throwing exception if we failstatic Boolean
Used to cast anything to a boolean, throwing exception if we failstatic Boolean
Used to cast anything to a boolean
-
Constructor Details
-
BooleanCaster
public BooleanCaster()
-
-
Method Details
-
attempt
Tests to see if the value can be cast to a boolean. Returns aCastAttempt<T>
which will contain the result if casting was successful, or can be interrogated to proceed otherwise.- Parameters:
object
- The value to cast to a boolean- Returns:
- The boolean value
-
cast
Used to cast anything to a boolean, throwing exception if we fail- Parameters:
object
- The value to cast to a boolean- Returns:
- The boolean value
-
cast
Used to cast anything to a boolean, throwing exception if we fail- Parameters:
object
- The value to cast to a booleanfail
- True to throw exception when failing- Returns:
- The boolean value
-
cast
Used to cast anything to a boolean- Parameters:
object
- The value to cast to a booleanfail
- True to throw exception when failing.loose
- True to allow for truthy and falsey values when casting- Returns:
- The boolean value, or null when cannot be cast
-