Class ParameterUtil

java.lang.Object
com.adobe.acs.commons.util.ParameterUtil

@ProviderType public class ParameterUtil extends Object
  • Method Summary

    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<<
    toMapEntry(String value, String separator)
    Util for parsing Service properties in the form <value><separator><value>
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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:bar
      separator - separator between the values
      Returns:
      Returns a Map.Entry representing the key/value pair. The entry's value may be null in 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:bar
      separator - separator between the values
      Returns:
      Returns a Map.Entry representing the key/value pair. It may be null in 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, xy ] ... 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, xy ] ... ex. ["dog:woof", "cat:meow"]
      separator - separator between the values
      allowValuelessKeys - true is keys are allowed without associated values
      defaultValue - 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, xy ] ... ex. ["dog:woof", "cat:meow"]
      separator - separator between the values
      allowValuelessKeys - true is keys are allowed without associated values
      defaultValue - default value to use if a value for a key is not present and allowValuelessKeys is true
      allowMultipleSeparators - 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 amp
      listSeparator - 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 amp
      listSeparator - separator between the values in each list
      allowValuelessKeys - true is keys are allowed without associated values
      defaultValue - 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

      public static List<Pattern> toPatterns(String[] values)
      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