Package com.adobe.acs.commons.util
Class ParameterUtil
- java.lang.Object
-
- com.adobe.acs.commons.util.ParameterUtil
-
@ProviderType public class ParameterUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,String>toMap(String[] values, String separator)Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected.static Map<String,String>toMap(String[] values, String separator, boolean allowValuelessKeys, String defaultValue)Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false.static Map<String,String>toMap(String[] values, String separator, boolean allowValuelessKeys, String defaultValue, boolean allowMultipleSeparators)Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false.static Map<String,String[]>toMap(String[] values, String mapSeparator, String listSeparator)Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<<static Map<String,String[]>toMap(String[] values, String mapSeparator, String listSeparator, boolean allowValuelessKeys, String defaultValue)Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<<static Map.Entry<String,String>toMapEntry(String value, String separator)Util for parsing Service properties in the form<value><separator><value>static Map.Entry<String,String>toMapEntryWithOptionalValue(String value, String separator)Util for parsing Service properties in the form<value><separator><value>static List<Pattern>toPatterns(String[] values)Util for converting a String[] into a List of compiled Patterns.
-
-
-
Method Detail
-
toMapEntryWithOptionalValue
public static Map.Entry<String,String> toMapEntryWithOptionalValue(String value, String separator)
Util for parsing Service properties in the form<value><separator><value>- Parameters:
value- must be in the format =>x<separator>y... ex.foo:barseparator- separator between the values- Returns:
- Returns a
Map.Entryrepresenting the key/value pair. The entry's value may benullin case no separator is found.
-
toMapEntry
public static Map.Entry<String,String> toMapEntry(String value, String separator)
Util for parsing Service properties in the form<value><separator><value>- Parameters:
value- must be in the format =>x<separator>y... ex.foo:barseparator- separator between the values- Returns:
- Returns a
Map.Entryrepresenting the key/value pair. It may benullin case no separator is found.
-
toMap
public static Map<String,String> toMap(String[] values, String separator)
Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected. To keep valueless keys used the overloaded version of this function with allowValuelessKeys = true- Parameters:
values- Array of key/value pairs in the format => [ ab, x y ] ... ex. ["dog:woof", "cat:meow"] separator- separator between the values- Returns:
- Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => "meow"
-
toMap
public static Map<String,String> toMap(String[] values, String separator, boolean allowValuelessKeys, String defaultValue)
Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false. To keep the valueless keys pass in allowValuelessKeys => true *- Parameters:
values- Array of key/value pairs in the format => [ ab, x y ] ... ex. ["dog:woof", "cat:meow"] separator- separator between the valuesallowValuelessKeys- true is keys are allowed without associated valuesdefaultValue- default value to use if a value for a key is not present and allowValuelessKeys is true- Returns:
-
toMap
public static Map<String,String> toMap(String[] values, String separator, boolean allowValuelessKeys, String defaultValue, boolean allowMultipleSeparators)
Util for parsing Arrays of Service properties in the form >value<>separator<>value< If a value is missing from a key/value pair, the entry is rejected only if allowValuelessKyes is false. To keep the valueless keys pass in allowValuelessKeys => true *- Parameters:
values- Array of key/value pairs in the format => [ ab, x y ] ... ex. ["dog:woof", "cat:meow"] separator- separator between the valuesallowValuelessKeys- true is keys are allowed without associated valuesdefaultValue- default value to use if a value for a key is not present and allowValuelessKeys is trueallowMultipleSeparators- if true, multiple separators are allowed per entry in which case only the first is considered. If false, entries with multiple separators are considered invalid- Returns:
-
toMap
public static Map<String,String[]> toMap(String[] values, String mapSeparator, String listSeparator)
Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<<- Parameters:
values- Array of key/value pairs in the format => [ a<map-separator>b, x<map-separator>y<list-separator>z ] ... ex. ["dog:woof", "cat:meow,purr"]mapSeparator- separator between the key/values in the amplistSeparator- separator between the values in each list- Returns:
- Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => ["meow", "purr"]
-
toMap
public static Map<String,String[]> toMap(String[] values, String mapSeparator, String listSeparator, boolean allowValuelessKeys, String defaultValue)
Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<<- Parameters:
values- Array of key/value pairs in the format => [ a<map-separator>b, x<map-separator>y<list-separator>z ] ... ex. ["dog:woof", "cat:meow,purr"]mapSeparator- separator between the key/values in the amplistSeparator- separator between the values in each listallowValuelessKeys- true is keys are allowed without associated valuesdefaultValue- default value to use if a value for a key is not present and allowValuelessKeys is true*- Returns:
- Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => ["meow", "purr"]
-
-