Class PropertyHelper

java.lang.Object
ortus.boxlang.runtime.config.util.PropertyHelper

public class PropertyHelper extends Object
Helps convert from JSON to native Java/BoxLang Types
  • Constructor Details

    • PropertyHelper

      public PropertyHelper()
  • Method Details

    • processListToSet

      public static void processListToSet(IStruct config, Key key, Set<String> target)
      This processes a JSON array list to a HashSet
      Parameters:
      config - The configuration object
      key - The target key to look and process
      target - The target set to populate
    • processStringOrArrayToList

      public static void processStringOrArrayToList(IStruct config, Key key, List<String> target)
      This processes: - A string to a list (comma separated or a single string) - A JSON array to a list
      Parameters:
      config - The configuration object
      key - The target key to look and process
      target - The target list to populate with the values
    • processStringOrArrayToArray

      public static void processStringOrArrayToArray(IStruct config, Key key, Array target)
      This processes: - A string to a BoxLang array (comma separated or a single string) - A JSON array to a BoxLang array
      Parameters:
      config - The configuration object
      key - The target key to look and process
      target - The target array to populate with the values
    • processString

      public static String processString(IStruct config, Key key, String defaultValue, Set<String> allowedValues)
      Process an incoming string, do replacements, and validate that it's a value within the allowed incoming set of values
      Parameters:
      config - The configuration object
      key - The target key to look and process
      defaultValue - The default value to return if the key is not found
      allowedValues - The set of allowed values. If not allowed, throw an exception
      Throws:
      BoxValidationException
    • processString

      public static String processString(IStruct config, Key key, String defaultValue)
      Process an incoming string, and do replacements. If the key is found, replace the value with the resolved value If the key is NOT found, do nothing
      Parameters:
      config - The configuration object
      key - The target key to look and process
    • processInteger

      public static Integer processInteger(IStruct config, Key key, Integer defaultValue)
      Process an incoming string, and do replacements and return the value as an integer
      Parameters:
      config - The configuration object
      key - The target key to look and process
      defaultValue - The default value to return if the key is not found
      Returns:
      The integer value
    • processBoolean

      public static boolean processBoolean(IStruct config, Key key, boolean defaultValue)
      Process an incoming string, and do replacements and return the value as a boolean
      Parameters:
      config - The configuration object
      key - The target key to look and process
      defaultValue - The default value to return if the key is not found
      Returns:
      The integer value
    • processToStruct

      public static IStruct processToStruct(IStruct config, Key key)
      Process a key that's supposed to be a IStruct and return it as a struct, else, return a new struct.
      Parameters:
      config - The configuration object
      key - The target key to look and process
      Returns:
      The struct