Class AssignableArrayCaster

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

public class AssignableArrayCaster extends Object implements IBoxCaster
I handle casting anything to a Array that needs to be assignable This means I reject - ImmutableLists - UnmodifiableLists I will ALLOW native Java arrays, because while their length is fixed, their indexes can be assigned.
  • Constructor Details

    • AssignableArrayCaster

      public AssignableArrayCaster()
  • Method Details

    • attempt

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

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

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