Class CollectionCaster

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

public class CollectionCaster extends Object implements IBoxCaster
I handle casting anything to a collection
  • Constructor Details

    • CollectionCaster

      public CollectionCaster()
  • Method Details

    • attempt

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

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

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