@Test public void testSimpleClass() throws Exception { String expected = "{\"value1\":1,\"value2\":\"blub\",\"value3\":2,\"value5\":3,\"value4\":" + "\"fasel\",\"intArray\":[5,6,7,8,9],\"value6\":true,\"value7\":false,\"value8\":1000," + "\"value9\":10.23,\"value10\":9.23,\"value11\":17,\"test\":" + "{\"mys\":\"bla\",\"mylist\":[\"entry1\",\"entry2\",\"entry3\",\"entry4\",\"entry5\"]," + "\"map\":{\"key1\":{\"innerfield\":\"innerfield_1\"}," + "\"key2\":{\"innerfield\":\"innerfield_2\"}," + "\"key3\":{\"innerfield\":\"innerfield_3\"}}}}"; AnnotatedTestClass c = new AnnotatedTestClass(); JSONAnnotationEncoder encoder = new JSONAnnotationEncoder(); String json = encoder.encode(c); TestCase.assertEquals(expected, json); }
public String encode(Object result) throws JSONException { StringBuilder builder = new StringBuilder(); encode(result, builder, null); return builder.toString(); }
JSONAnnotationEncoder { public String encode(Object result) throws JSONException { StringBuilder builder = new StringBuilder(); encode(result, builder, null); return builder.toString(); } }
JSONAnnotationEncoder { public String encode(Object result) throws JSONException { StringBuilder builder = new StringBuilder(); encode(result, builder, null); return builder.toString(); }  }
JSONAnnotationEncoder { public String encode(Object result) throws JSONException { StringBuilder builder = new StringBuilder(); encode(result, builder, null); return builder.toString(); }  String encode(Object result); @SuppressWarnings("unchecked") void encode(Object result, StringBuilder builder, JSON annotation); }
JSONAnnotationEncoder { public String encode(Object result) throws JSONException { StringBuilder builder = new StringBuilder(); encode(result, builder, null); return builder.toString(); }  String encode(Object result); @SuppressWarnings("unchecked") void encode(Object result, StringBuilder builder, JSON annotation);  }