Class StringCaster

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

public class StringCaster extends Object implements IBoxCaster
I handle casting anything to a string
  • Constructor Details

    • StringCaster

      public StringCaster()
  • Method Details

    • attempt

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

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

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

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

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

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