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