Package com.adobe.acs.commons.util
Class ParameterUtil
java.lang.Object
com.adobe.acs.commons.util.ParameterUtil
-
Method Summary
Modifier and TypeMethodDescriptionUtil 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.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.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.Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<<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<<toMapEntry(String value, String separator) Util for parsing Service properties in the form<value><separator><value>toMapEntryWithOptionalValue(String value, String separator) Util for parsing Service properties in the form<value><separator><value>toPatterns(String[] values) Util for converting a String[] into a List of compiled Patterns.
-
Method Details
-
toMapEntryWithOptionalValue
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
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
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"]
-
toPatterns
Util for converting a String[] into a List of compiled Patterns. Empty/blank strings will be skipped.- Parameters:
values- the Strings to convert to patterns.- Returns:
- a List of Patterns
-