@Test public void parseNoValue() { NameValue nv = NameValue.parse("a"); assertThat(nv.name, equalTo("a")); assertThat(nv.value, equalTo(NameValue.TRUE)); }
public static NameValue parse(final String input) { checkNotNull(input); String name, value; int i = input.indexOf(SEPARATOR); if (i == -1) { name = input; value = TRUE; } else { name = input.substring(0, i); value = input.substring(i + 1, input.length()); } return new NameValue(name.trim(), value); }
NameValue { public static NameValue parse(final String input) { checkNotNull(input); String name, value; int i = input.indexOf(SEPARATOR); if (i == -1) { name = input; value = TRUE; } else { name = input.substring(0, i); value = input.substring(i + 1, input.length()); } return new NameValue(name.trim(), value); } }
NameValue { public static NameValue parse(final String input) { checkNotNull(input); String name, value; int i = input.indexOf(SEPARATOR); if (i == -1) { name = input; value = TRUE; } else { name = input.substring(0, i); value = input.substring(i + 1, input.length()); } return new NameValue(name.trim(), value); } private  NameValue(final String name, final String value); }
NameValue { public static NameValue parse(final String input) { checkNotNull(input); String name, value; int i = input.indexOf(SEPARATOR); if (i == -1) { name = input; value = TRUE; } else { name = input.substring(0, i); value = input.substring(i + 1, input.length()); } return new NameValue(name.trim(), value); } 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 NameValue parse(final String input) { checkNotNull(input); String name, value; int i = input.indexOf(SEPARATOR); if (i == -1) { name = input; value = TRUE; } else { name = input.substring(0, i); value = input.substring(i + 1, input.length()); } return new NameValue(name.trim(), value); } 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; }