@Test public void dontPrintNullValues() throws Exception { long value = 0L; ParentType parent = new ParentType(null, value, null); String expectedValue = "{}"; assertEquals("expected value should not contain null values", expectedValue, test.toJSON(parent)); }
public String toJSON(T value) throws IOException { Writer writer = new StringWriter(); toJSON(writer, value); return writer.toString(); }
AbstractJsonTranslator { public String toJSON(T value) throws IOException { Writer writer = new StringWriter(); toJSON(writer, value); return writer.toString(); } }
AbstractJsonTranslator { public String toJSON(T value) throws IOException { Writer writer = new StringWriter(); toJSON(writer, value); return writer.toString(); } AbstractJsonTranslator(Class<? extends AbstractJsonTranslator<?>> subclass); }
AbstractJsonTranslator { public String toJSON(T value) throws IOException { Writer writer = new StringWriter(); toJSON(writer, value); return writer.toString(); } AbstractJsonTranslator(Class<? extends AbstractJsonTranslator<?>> subclass); T fromJSON(String json); @SuppressWarnings("unchecked") T fromJSON(Reader reader); String toJSON(T value); void toJSON(Writer writer, T value); void usePrettyPrinter(); void disablePrettyPrint(); }
AbstractJsonTranslator { public String toJSON(T value) throws IOException { Writer writer = new StringWriter(); toJSON(writer, value); return writer.toString(); } AbstractJsonTranslator(Class<? extends AbstractJsonTranslator<?>> subclass); T fromJSON(String json); @SuppressWarnings("unchecked") T fromJSON(Reader reader); String toJSON(T value); void toJSON(Writer writer, T value); void usePrettyPrinter(); void disablePrettyPrint();  }