@Test public void parseString() throws IOException { assertEquals(ValueFactory.create(""), json.filterValue(ValueFactory.create("\"\""))); assertEquals(ValueFactory.create("foo"), json.filterValue(ValueFactory.create("\"foo\""))); assertEquals(ValueFactory.create("foo\"bar"), json.filterValue(ValueFactory.create("\"foo\\\"bar\""))); assertEquals(ValueFactory.create("foo\\bar"), json.filterValue(ValueFactory.create("\"foo\\\\bar\""))); assertEquals(ValueFactory.create("foo,bar"), json.filterValue(ValueFactory.create("\"foo,bar\""))); roundTrip(ValueFactory.create("")); roundTrip(ValueFactory.create("foo")); roundTrip(ValueFactory.create("foo\"bar")); roundTrip(ValueFactory.create("foo\\bar")); roundTrip(ValueFactory.create("foo,bar")); }
@Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }
ValueFilterJSON extends AbstractValueFilter { @Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } } }
ValueFilterJSON extends AbstractValueFilter { @Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }  }
ValueFilterJSON extends AbstractValueFilter { @Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }  @Nullable @Override ValueObject filterValue(@Nullable ValueObject value); }
ValueFilterJSON extends AbstractValueFilter { @Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }  @Nullable @Override ValueObject filterValue(@Nullable ValueObject value);  }