Class PropertyHelper
java.lang.Object
ortus.boxlang.runtime.config.util.PropertyHelper
Helps convert from JSON to native Java/BoxLang Types
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanprocessBoolean(IStruct config, Key key, boolean defaultValue) Process an incoming string, and do replacements and return the value as a booleanstatic IntegerprocessInteger(IStruct config, Key key, Integer defaultValue) Process an incoming string, and do replacements and return the value as an integerstatic voidprocessListToSet(IStruct config, Key key, Set<String> target) This processes a JSON array list to a HashSetstatic StringprocessString(IStruct config, Key key, String defaultValue) Process an incoming string, and do replacements.static StringProcess an incoming string, do replacements, and validate that it's a value within the allowed incoming set of valuesstatic voidprocessStringOrArrayToArray(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 arraystatic voidprocessStringOrArrayToList(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 liststatic IStructprocessToStruct(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.
-
Constructor Details
-
PropertyHelper
public PropertyHelper()
-
-
Method Details
-
processListToSet
This processes a JSON array list to a HashSet- Parameters:
config- The configuration objectkey- The target key to look and processtarget- The target set to populate
-
processStringOrArrayToList
This processes: - A string to a list (comma separated or a single string) - A JSON array to a list- Parameters:
config- The configuration objectkey- The target key to look and processtarget- The target list to populate with the values
-
processStringOrArrayToArray
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 objectkey- The target key to look and processtarget- 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 objectkey- The target key to look and processdefaultValue- The default value to return if the key is not foundallowedValues- The set of allowed values. If not allowed, throw an exception- Throws:
BoxValidationException
-
processString
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 objectkey- The target key to look and process
-
processInteger
Process an incoming string, and do replacements and return the value as an integer- Parameters:
config- The configuration objectkey- The target key to look and processdefaultValue- The default value to return if the key is not found- Returns:
- The integer value
-
processBoolean
Process an incoming string, and do replacements and return the value as a boolean- Parameters:
config- The configuration objectkey- The target key to look and processdefaultValue- The default value to return if the key is not found- Returns:
- The integer value
-
processToStruct
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 objectkey- The target key to look and process- Returns:
- The struct
-