Class ThrowableCaster

java.lang.Object
ortus.boxlang.runtime.dynamic.casters.ThrowableCaster
All Implemented Interfaces:
IBoxCaster

public class ThrowableCaster extends Object implements IBoxCaster
I handle casting anything to a Throwable
  • Constructor Details

    • ThrowableCaster

      public ThrowableCaster()
  • Method Details

    • attempt

      public static CastAttempt<Throwable> attempt(Object object)
      Tests to see if the value can be cast to a Throwable. Returns a CastAttempt<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 Throwable
      Returns:
      The Throwable value
    • cast

      public static Throwable cast(Object object)
      Used to cast anything to a Throwable, throwing exception if we fail
      Parameters:
      object - The value to cast to a Throwable
      Returns:
      The Throwable value
    • cast

      public static Throwable cast(Object object, Boolean fail)
      Used to cast anything to a Throwable
      Parameters:
      object - The value to cast to a Throwable
      fail - True to throw exception when failing.
      Returns:
      The Throwable value