/** * 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 * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @return Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => "meow" */ public static Map<String, String> toMap(final String[] values, final String separator) { return toMap(values, separator, false, null); }
protected List<Map.Entry<String, String>> convertServiceSpecificHeaders(String[] specificServiceHeaders) { if (specificServiceHeaders == null) { return Collections.emptyList(); } else { return Arrays.asList(specificServiceHeaders).stream() .map(s -> ParameterUtil.toMapEntry(s, ":")) .filter(e -> e != null).collect(Collectors.toList()); } }
/** * Util for parsing Service properties in the form {@code <value><separator><value>} * * @param value must be in the format => {@code x<separator>y} ... ex. {@code foo:bar} * @param separator separator between the values * @return Returns a {@link Map.Entry} representing the key/value pair. The entry's value may be {@code null} in case no separator is found. */ public static Map.Entry<String, String> toMapEntryWithOptionalValue(final String value, final String separator) { return toSimpleEntry(value, separator, true); }
@Activate protected void activate(Map<String, Object> configs) { resourceTypePatterns = ParameterUtil.toPatterns(PropertiesUtil.toStringArray(configs.get(PROP_RESOURCE_TYPES), new String[]{})); pathPatterns = ParameterUtil.toPatterns(PropertiesUtil.toStringArray(configs.get(PROP_PATHS), new String[]{})); log.info("ResourceHttpCacheConfigExtension activated/modified."); } }
Map.Entry<String, String> nodeTypeAndPathRestriction = ParameterUtil.toMapEntryWithOptionalValue(nodeTypeAndPathRestrictionEntry, " "); final Pattern pathRestrictionPattern; if (StringUtils.isNotBlank(nodeTypeAndPathRestriction.getValue())) {
@Activate protected void activate(Config config) { resourceTypePatterns = ParameterUtil.toPatterns(config.httpcache_config_extension_resourcetypes_allowed()); pathPatterns = ParameterUtil.toPatterns(config.httpcache_config_extension_paths_allowed()); checkContentResourceType = config.httpcacheconfig_extension_resourcetypes_page_content(); log.info("ResourceHttpCacheConfigExtension activated/modified."); } }
/** * 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 * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @return Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => "meow" */ public static Map<String, String> toMap(final String[] values, final String separator) { return toMap(values, separator, false, null); }
/** * Util for parsing Service properties in the form {@code <value><separator><value>} * * @param value must be in the format => {@code x<separator>y} ... ex. {@code foo:bar} * @param separator separator between the values * @return Returns a {@link Map.Entry} representing the key/value pair. It may be {@code null} in case no separator is found. */ public static Map.Entry<String, String> toMapEntry(final String value, final String separator) { return toSimpleEntry(value, separator, false); }
Map.Entry<String, String> entry = ParameterUtil.toMapEntry(segment, KEY_VALUE_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 only if allowValuelessKyes is false. * To keep the valueless keys pass in allowValuelessKeys => true * * * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @param allowValuelessKeys true is keys are allowed without associated values * @param defaultValue default value to use if a value for a key is not present and allowValuelessKeys is true * @return */ public static Map<String, String> toMap(final String[] values, final String separator, final boolean allowValuelessKeys, final String defaultValue) { return toMap(values, separator, allowValuelessKeys, defaultValue, false); }
/** * Util for parsing Service properties in the form >value<>separator<>value< * * @param value must be in the format => x<separator>y ... ex. foo:bar * @param separator separator between the values * @return Returns a SimpleEntry representing the key/value pair */ @Deprecated public static AbstractMap.SimpleEntry<String, String> toSimpleEntry(final String value, final String separator) { return ParameterUtil.toSimpleEntry(value, 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 only if allowValuelessKyes is false. * To keep the valueless keys pass in allowValuelessKeys => true * * * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @param allowValuelessKeys true is keys are allowed without associated values * @param defaultValue default value to use if a value for a key is not present and allowValuelessKeys is true * @return */ public static Map<String, String> toMap(final String[] values, final String separator, final boolean allowValuelessKeys, final String defaultValue) { return toMap(values, separator, allowValuelessKeys, defaultValue, false); }
/** * 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 * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @return Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => "meow" */ @Deprecated public static Map<String, String> toMap(final String[] values, final String separator) { return ParameterUtil.toMap(values, separator, false, null); }
/** * Util for parsing Arrays of Service properties in the form >value<>map-separator<>value>list-separator<>value<< * * @param 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"] * @param mapSeparator separator between the key/values in the amp * @param listSeparator separator between the values in each list * @return Map of key/value pairs; map.get("dog") => "woof", map.get("cat") => "meow" */ @Deprecated public static Map<String, String[]> toMap(final String[] values, final String mapSeparator, final String listSeparator) { return ParameterUtil.toMap(values, mapSeparator, listSeparator); } }
/** * 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 * * * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @param allowValuelessKeys true is keys are allowed without associated values * @param defaultValue default value to use if a value for a key is not present and allowValuelessKeys is true * @return */ @Deprecated public static Map<String, String> toMap(final String[] values, final String separator, final boolean allowValuelessKeys, final String defaultValue) { return ParameterUtil.toMap(values, separator, allowValuelessKeys, defaultValue, false); }
/** * 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 * * * * @param values Array of key/value pairs in the format => [ a<separator>b, x<separator>y ] ... ex. ["dog:woof", "cat:meow"] * @param separator separator between the values * @param allowValuelessKeys true is keys are allowed without associated values * @param defaultValue default value to use if a value for a key is not present and allowValuelessKeys is true * @param 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 * @return */ @Deprecated public static Map<String, String> toMap(final String[] values, final String separator, final boolean allowValuelessKeys, final String defaultValue, final boolean allowMultipleSeparators) { return ParameterUtil.toMap(values, separator, allowValuelessKeys, defaultValue, allowMultipleSeparators); }
@Activate protected final void activate(WCMViewsServlet.Config config) { final String[] tmp = config.wcm$_$views(); this.defaultViews = ParameterUtil.toMap(tmp, "=", ";"); } }
private Map<String, String> getProcessArgsMap(MetaDataMap metaDataMap) { final String processArgs = metaDataMap.get(WorkflowHelper.PROCESS_ARGS, ""); return ParameterUtil.toMap(StringUtils.split(processArgs, System.getProperty("line.separator")), "="); } }
private Map<String, String> extractWorkflowParams(MetaDataMap metadataMap) { String[] lines = StringUtils.split(metadataMap.get(WorkflowHelper.PROCESS_ARGS, ""), System.lineSeparator()); Map<String, String> params = ParameterUtil.toMap(lines, "="); return params; }
@Activate protected void activate(final Map<String, Object> config) { final String[] attrProp = PropertiesUtil.toStringArray(config.get(PROP_ATTRIBUTES), DEFAULT_ATTRIBUTES); this.attributes = ParameterUtil.toMap(attrProp, ":", ","); }