/** * Parses a String comprised of 0 or more comma-delimited key=value pairs where each key * has the format: {@code app.[appname].[key]} or {@code deployer.[appname].[key]}. Values * may themselves contain commas, since the split points will be based upon the key * pattern. * <p> * Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. * keys will not have commas or equals. 2. First raw split is done by commas which will * need to be fixed later if value is a comma-delimited list. * * @param s the string to parse * @return the Map of parsed key value pairs */ public static Map<String, String> parse(String s) { Map<String, String> deploymentProperties = new LinkedHashMap<>(); List<String> pairs = parseParamList(s, ","); // add what we got, addKeyValuePairAsProperty // handles rest as trimming, etc for (String pair : pairs) { addKeyValuePairAsProperty(pair, deploymentProperties); } return deploymentProperties; }
/** * Parses a String comprised of 0 or more comma-delimited key=value pairs where each key * has the format: {@code app.[appname].[key]} or {@code deployer.[appname].[key]}. Values * may themselves contain commas, since the split points will be based upon the key * pattern. * <p> * Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. * keys will not have commas or equals. 2. First raw split is done by commas which will * need to be fixed later if value is a comma-delimited list. * * @param s the string to parse * @return the Map of parsed key value pairs */ public static Map<String, String> parse(String s) { Map<String, String> deploymentProperties = new LinkedHashMap<>(); List<String> pairs = parseParamList(s, ","); // add what we got, addKeyValuePairAsProperty // handles rest as trimming, etc for (String pair : pairs) { addKeyValuePairAsProperty(pair, deploymentProperties); } return deploymentProperties; }