@Test public void decodeWithSlash() { String input = "foo=bar/baz=ick"; Map<String, String> have = NameValue.decode(input); assertEquals(2, have.size()); assertEquals("bar", have.get("foo")); assertEquals("ick", have.get("baz")); }
public static Map<String, String> decode(final String pattern, final String input, final boolean trimValue) { checkNotNull(input); Map<String, String> parameters = Maps.newLinkedHashMap(); for (String item : input.split(pattern)) { NameValue nv = NameValue.parse(item); parameters.put(nv.name, trimValue ? nv.value.trim() : nv.value); } return parameters; }
NameValue { public static Map<String, String> decode(final String pattern, final String input, final boolean trimValue) { checkNotNull(input); Map<String, String> parameters = Maps.newLinkedHashMap(); for (String item : input.split(pattern)) { NameValue nv = NameValue.parse(item); parameters.put(nv.name, trimValue ? nv.value.trim() : nv.value); } return parameters; } }
NameValue { public static Map<String, String> decode(final String pattern, final String input, final boolean trimValue) { checkNotNull(input); Map<String, String> parameters = Maps.newLinkedHashMap(); for (String item : input.split(pattern)) { NameValue nv = NameValue.parse(item); parameters.put(nv.name, trimValue ? nv.value.trim() : nv.value); } return parameters; } private  NameValue(final String name, final String value); }
NameValue { public static Map<String, String> decode(final String pattern, final String input, final boolean trimValue) { checkNotNull(input); Map<String, String> parameters = Maps.newLinkedHashMap(); for (String item : input.split(pattern)) { NameValue nv = NameValue.parse(item); parameters.put(nv.name, trimValue ? nv.value.trim() : nv.value); } return parameters; } private  NameValue(final String name, final String value); static NameValue parse(final String input); String toString(); static Map<String, String> decode(final String pattern, final String input, final boolean trimValue); static Map<String, String> decode(final String input, final boolean trimValue); static Map<String, String> decode(final String input); }
NameValue { public static Map<String, String> decode(final String pattern, final String input, final boolean trimValue) { checkNotNull(input); Map<String, String> parameters = Maps.newLinkedHashMap(); for (String item : input.split(pattern)) { NameValue nv = NameValue.parse(item); parameters.put(nv.name, trimValue ? nv.value.trim() : nv.value); } return parameters; } private  NameValue(final String name, final String value); static NameValue parse(final String input); String toString(); static Map<String, String> decode(final String pattern, final String input, final boolean trimValue); static Map<String, String> decode(final String input, final boolean trimValue); static Map<String, String> decode(final String input); static final String SEPARATOR; static final String TRUE; final String name; final String value; }