Commit Graph

831 Commits

Author SHA1 Message Date
Jesse Wilson
6cca23c172 Get GraphAdapterBuilder working for serialization and deserialization using InstanceCreators to get a sneak peek at a value under construction. 2012-01-01 13:42:44 +00:00
Jesse Wilson
d4a1e49e46 Delete some obsolete TODOs 2012-01-01 12:42:48 +00:00
Jesse Wilson
796a381279 Kill GsonInternalAccess. Clients to this were all broken because nobody was ever assigning INSTANCE. 2012-01-01 12:42:20 +00:00
Jesse Wilson
323dfa0af5 Be strict in TypeAdapter's toJson/fromJson methods 2012-01-01 12:36:42 +00:00
Jesse Wilson
641590b5b6 Fill in some gaps in ExclusionStrategy's test.
Changes to GsonInternalAccess should have broken exclusion strategies, but didn't. Adding these tests cause the expected breaks.
2012-01-01 12:34:47 +00:00
Jesse Wilson
c4ea9a3d87 New Javadocs for Gson 2.1. 2011-12-31 20:53:38 +00:00
Jesse Wilson
caf64dbf55 Remove Javadocs without proper mime types set 2011-12-31 20:52:11 +00:00
Inderjeet Singh
6c78bf5247 made toJson/fromJson/toJsonTree methods public in TypeAdapter.
made Gson.getNextAdapter method public.
2011-12-31 08:52:59 +00:00
Inderjeet Singh
49525c8d64 Javadocs for Gson 2.1 2011-12-31 07:53:30 +00:00
Inderjeet Singh
73d973f1d7 [maven-release-plugin] prepare for next development iteration 2011-12-31 07:14:29 +00:00
Inderjeet Singh
2177850ba1 [maven-release-plugin] prepare release gson-2.1 2011-12-31 07:14:21 +00:00
Inderjeet Singh
498049b304 updated documentation for registerTypeHierarchyAdapter to cover TypeAdapter. 2011-12-31 06:00:28 +00:00
Inderjeet Singh
46d2d79ba7 Added javadocs for type adapter registration through registerTypeAdapter method. 2011-12-31 05:32:14 +00:00
Jesse Wilson
ecdf9150f6 Hide Gson.getNextAdapter() for the current release. 2011-12-31 05:30:40 +00:00
Jesse Wilson
4057b98bab Implement all but the most difficult part of graph type adapter's deserialization. The catch is we want to return an instance that we don't have yet. It's on the stack, but we don't have a handle to it because it's inside the 'nextTypeAdapter' who is busy populating its fields. 2011-12-30 08:27:24 +00:00
Jesse Wilson
6ec6caa49d New extension: handle circular references.
Serialize graphs of objects by assigning each instance a generated ID and writing the complete graph out as a list. The output for a cycle of Rock/Scissors/Paper looks like this:

{
  '0x1':{'name':'ROCK','beats':'0x2'},
  '0x2':{'name':'SCISSORS','beats':'0x3'},
  '0x3':{'name':'PAPER','beats':'0x1'}
}

This is work towards issue 137. The hard part is going to be deserializing that back into a graph.
2011-12-30 07:34:43 +00:00
Jesse Wilson
bcaf56079c Register runtime type adapters using the proper factory-specific APIs. 2011-12-30 06:55:56 +00:00
Jesse Wilson
4cb1b88115 Test for registerTypeHierarchyAdapter() using Date.class
Fixes issue 352.
2011-12-29 07:27:33 +00:00
Jesse Wilson
6d2cf4a853 Test for excludeFieldsWithModifiers().
Fixes issue 324.
2011-12-29 07:17:36 +00:00
Jesse Wilson
740d03ef0e Don't call setAccessible(true) on fields we won't be setting or getting.
Fixes bug 191.
2011-12-29 07:11:43 +00:00
Jesse Wilson
8d5de3136c Inline character unescaping. This saves ~10% on the READER_LONG benchmark. 2011-12-25 07:09:46 +00:00
Jesse Wilson
d7fbac0384 Rename TypeAdapter.Factory to TypeAdapterFactory. 2011-12-23 18:27:13 +00:00
Inderjeet Singh
2cd3f9707f Incorporated feedback from r1082 2011-12-23 16:11:12 +00:00
Inderjeet Singh
82f18a257f Implemented code review comments from r1090 2011-12-23 15:52:10 +00:00
Inderjeet Singh
bd937fe7b5 A type adapter for Class that throws an UnsupportedOperationException. 2011-12-22 22:31:43 +00:00
Inderjeet Singh
1c850dc3ea updated to Gson 2.1-SNAPSHOT 2011-12-22 21:22:42 +00:00
Jesse Wilson
13c1946621 More tests that skipValue() is no less strict. 2011-12-21 21:43:55 +00:00
Jesse Wilson
b28e518c7e Hide toJson/fromJson APIs for the 2.1 release. 2011-12-21 21:30:18 +00:00
Jesse Wilson
dd9ae67af5 Test that skipValue is strict on unquoted strings. 2011-12-21 20:40:33 +00:00
Inderjeet Singh
b5ae3c945a Incorporated code review from r949 2011-12-16 19:10:54 +00:00
Jesse Wilson
a3ca4e1312 Admit to a mistake in InetAddress' type adapter 2011-12-16 19:05:10 +00:00
Jesse Wilson
f24da51ca2 Fix dangling sentence. 2011-12-16 19:00:37 +00:00
Inderjeet Singh
4b8fd66c9d Added a test for issue 389 2011-12-16 17:21:31 +00:00
Jesse Wilson
c01fc5c935 Fix tests broken by r1078. 2011-12-16 14:12:34 +00:00
Inderjeet Singh
8fcbd57e59 Updated Export-Manifest for OSGi to 2.1 2011-12-16 06:04:18 +00:00
Jesse Wilson
2ef7716209 Fix a broken Javadoc link to this. 2011-12-16 05:38:16 +00:00
Jesse Wilson
214234e202 Support @SerializedName on annotations.
Fixes issue 347.
2011-12-16 05:32:50 +00:00
Jesse Wilson
bb92447317 Retain annotations when using proguard + gson. From patch on issue 358.
Fixes issue 358.
2011-12-16 05:18:01 +00:00
Jesse Wilson
d891661c4a Apply locale fix for date type adapter test.
Fixes issue 381.
2011-12-16 04:57:22 +00:00
Jesse Wilson
dce4e463d9 Apply variable name improvement from issue 385.
Fixes issue 385.
2011-12-16 04:55:54 +00:00
Jesse Wilson
5acaee4ebc Check in our best Jackson vs. Gson comparison benchmarks.
http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.gson.metrics.ParseBenchmark
2011-12-15 07:03:01 +00:00
Jesse Wilson
b7c3e0067c Avoid local field accesses in nextString(char). This saves a modest 2%. 2011-12-14 06:07:40 +00:00
Jesse Wilson
d01d39aa26 Use locals instead of fields when figuring out the buffer's offset line and column. This saves about 2% when parsing twitter data. 2011-12-14 05:49:58 +00:00
Jesse Wilson
aa52435951 Apply an ugly optimization to save 5% on pretty printed JSON documents. This uses locals instead of fields in an inner loop to save field reads and writes. 2011-12-14 05:26:29 +00:00
Jesse Wilson
40cd660115 Always provide line and column information when a parse fails. 2011-12-13 23:42:10 +00:00
Jesse Wilson
8e8bf934f9 Inline the nesting stack to save ~20% on JsonReader parsing. 2011-12-13 04:08:48 +00:00
Jesse Wilson
61a549b74d Don't allocate exceptions in the common case. On one benchmark this improved performance by 20%. 2011-12-13 03:24:35 +00:00
Jesse Wilson
eb2230caf0 Fix nullSafe() to not infinitely recurse on non-null input. 2011-12-06 15:35:52 +00:00
Jesse Wilson
e2e672740a Fix broken test in registering competing type hierarchy adapters.
I actually tried to replicate this test but got an error "type adapters conflict" when I was doing it. I suspect the problem was that I was trying to use 'Object' as the base of my type hierarchy and that class is somehow special.
2011-12-06 15:29:48 +00:00
Inderjeet Singh
b19e187bdd Minor improvements to TypeAdapter javadocs to promote the use of nullSafe. 2011-12-06 08:32:19 +00:00