Class StructCasterLoose

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

public class StructCasterLoose extends Object implements IBoxCaster
I handle casting anything to a Struct, except I'll also cast any Java classes which are not a built in datatype into a struct, using the public fields as the keys and the values as the values.
  • Constructor Details

    • StructCasterLoose

      public StructCasterLoose()
  • Method Details

    • attempt

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

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

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