Commit Graph

750 Commits

Author SHA1 Message Date
Jesse Wilson
f39ac8d946 Update extras to build after today's Gson/MiniGson refactoring. 2011-11-21 05:09:14 +00:00
Jesse Wilson
f89e92aa9f Tighten up some of the fields naming policy code. The main thrust of this change is replacing classes like UpperCaseNamingPolicy with the corresponding method calls. Classes like CompositeFieldNamingPolicy are replaced by sequences of method calls. This also replaces unit tests with functional tests.
One nice benefit of this is a 3%/5.7KiB reduction in the size of gson.jar to 184KiB.
2011-11-21 05:08:23 +00:00
Jesse Wilson
f777a192ee Remove dead code and fold contents of single-member helper classes into their clients. 2011-11-20 21:02:26 +00:00
Jesse Wilson
e9521471aa Fix typo: Paramterized was spelled wong. 2011-11-20 20:31:10 +00:00
Jesse Wilson
a00c5ff9f1 Simplify inner strategy in LongSerializationPolicy. 2011-11-20 20:16:46 +00:00
Jesse Wilson
1540201713 Remove unused interface 2011-11-20 20:15:45 +00:00
Jesse Wilson
d391584d48 Register Gson 1.x tree-style adapters in the TypeAdapter.Factory list rather than in the ParameterizedTypeHandlerMap.
The motivation for this change is to give tree-style adapters precedence order in registration. This fixes the test I committed earlier today, where registration order was not honored.

This renamed ParameterizedTypeHandlerMap to the shorter 'TypeMap'. For type adapters, this is now only used for type hierarchy. We still need non-hierarchy support in TypeMap for instance creators; I'll be looking for workarounds to see if further simplification is possible here.
2011-11-20 19:55:01 +00:00
Jesse Wilson
777e17c723 No more system type adapters. 2011-11-20 18:03:46 +00:00
Jesse Wilson
3f5caea95e New (failing) test to demonstrate that we're broken with precedence of streaming vs. nonstreaming type adapters. 2011-11-20 15:35:26 +00:00
Jesse Wilson
7e760143fd Smash together MiniGson and Gson. This changes Gson to be the MiniGson rather than delegating to the MiniGson. It means that the MiniGson objects passed into streaming type adapters are now fully-capable 'Gson' objects.
The most notable impact of this change is that it adds several new public APIs:
 - The TypeAdapter abstract class
 - The TypeAdapter.Factory interface
 - Four new methods on GsonBuilder to register streaming TypeAdapters (via Factory, via Class, via TypeToken, and as a type hierarchy)
 - Three new methods on Gson to lookup streaming TypeAdapters (by type, by class, and to get the next type adapter) 

Still outstanding:
 - Write beautiful prose to document the new APIs above
 - Change GsonBuilder's precedence so that both old and new-style type adapters are registered in one lot
2011-11-20 15:23:08 +00:00
Jesse Wilson
df31d2db16 Update Javadoc to 2.0 part 4 (got the SVN types right?) 2011-11-18 16:07:57 +00:00
Jesse Wilson
dbf5486615 Update Javadoc to 2.0 part 3 (got the SVN types wrong) 2011-11-18 16:04:10 +00:00
Jesse Wilson
fca0ff129f Update Javadoc to 2.0 part 2 2011-11-18 15:59:20 +00:00
Jesse Wilson
2a72d949d0 Update Javadoc to 2.0 part 1 2011-11-18 15:57:31 +00:00
Joel Leitch
65e9215a07 [maven-release-plugin] prepare for next development iteration 2011-11-13 21:10:17 +00:00
Joel Leitch
878314c5b8 [maven-release-plugin] prepare release gson-2.0 2011-11-13 21:10:06 +00:00
Joel Leitch
b900dc4af8 Update maven release plugin. 2011-11-13 21:08:28 +00:00
Joel Leitch
a92cf394e8 Fix compile issues found during release. 2011-11-13 20:04:29 +00:00
Joel Leitch
2c19c43905 Adding Jesse's name to the JsonElementReader file. 2011-11-13 00:27:57 +00:00
Joel Leitch
2cbddbbbc5 - Remove unnecessary catch block 2011-11-13 00:04:39 +00:00
Inderjeet Singh
3e303ef6f7 Excluded javadocs for internal packages. removed company name for Inder. 2011-11-13 00:03:14 +00:00
Jesse Wilson
3a3c5b2b1a I'm move Gson 2.0 notes to the sites page. 2011-11-12 23:34:50 +00:00
Jesse Wilson
172143df7c Removing JsonObject.deepCopy() and JsonArray.deepCopy() 2011-11-12 23:32:44 +00:00
Jesse Wilson
0ac36805c2 Remove an unnecessary cast from example code. 2011-10-24 14:14:34 +00:00
Jesse Wilson
00946277e8 Track change in thrown exception. 2011-10-24 05:03:06 +00:00
Jesse Wilson
016261d9cf Throw JsonParseException in event of binding failures like type mismatches. 2011-10-24 01:32:46 +00:00
Jesse Wilson
c226bd4f3f Tests to illustrate differences between GSON 1.7 and 2.0 2011-10-23 22:44:13 +00:00
Jesse Wilson
0340e01f98 Support booleans as strings in stream binding. Remove support for interpreting "1" as true.
Interpreting '1' as true was not backwards compatible.
2011-10-23 21:41:30 +00:00
Jesse Wilson
052c9ce0ce Honor our 'ignore nulls' policy when converting objects to JSON trees. 2011-10-23 20:28:04 +00:00
Jesse Wilson
290fb69a50 Provide more diagnostics when a constructor fails. 2011-10-22 20:22:47 +00:00
Jesse Wilson
94d59b550e Give a nice toString on type adapter factories to make debugging easier. 2011-10-22 19:26:15 +00:00
Jesse Wilson
90c9eadda1 custom-collections 2011-10-22 19:25:30 +00:00
Inderjeet Singh
339d3dd4d0 The real reason for this CL is to claim commit #1000 :)
Tiny performance enhancement: Reordered type orders to move up String and Integer which are likely to be most common fields.
2011-10-20 21:42:45 +00:00
Inderjeet Singh
905b7ebccc Using single quote in JSON that would be deserialized. This makes the JSON easier to read. 2011-10-20 21:35:39 +00:00
Inderjeet Singh
31964507c1 Updated SuppressWarnings annotations to Eclipse 3.6/3.7 which is unfortunately incompatible with Eclipse 3.5 (rawtypes vs unchecked)
This CL eliminates all eclipse warnings.
2011-10-20 21:32:46 +00:00
Jesse Wilson
cc5cbe5a1f Integration test for long serialization policy. 2011-10-20 04:57:58 +00:00
Jesse Wilson
194c18d20c Be backwards-compatible for serialization of maps whose keys aren't primitives. 2011-10-20 04:24:27 +00:00
Jesse Wilson
b892c85909 Sync RuntimeTypeAdapterFactory to recent internal API changes 2011-10-19 17:49:02 +00:00
Jesse Wilson
0e02cbb33e Nulls are here to stay. Sigh. 2011-10-14 03:20:05 +00:00
Jesse Wilson
5db4caeec5 A whole bunch of tests for support for null elements.
Fixes bug 369
2011-10-14 03:17:12 +00:00
Inderjeet Singh
c4a2291866 Deleted unused fields. 2011-10-02 20:45:26 +00:00
Jesse Wilson
65df3b97ba Add a type adapter for JsonElement, so it serializes just like everything else.
Fixes issue 362.
2011-10-02 16:59:56 +00:00
Jesse Wilson
3a3870591e Tests to demonstrate that GSON 2 fixes some user-reported bugs. 2011-10-02 15:18:12 +00:00
Jesse Wilson
01661426f9 Fix broken example.
Fixes bug 360.
2011-10-01 04:09:38 +00:00
Jesse Wilson
de727d8c48 Delete dead code found by coverage 2011-10-01 02:04:48 +00:00
Jesse Wilson
38ce53766e More consistency on serializeNulls: we never emit the empty string for top-level objects. 2011-10-01 01:10:11 +00:00
Jesse Wilson
de835d4dcd Roll back JsonSerializationContext and JsonDeserializationContext to their 1.7.2 API. 2011-10-01 00:58:25 +00:00
Jesse Wilson
70abd0ba87 Finishing touches on JsonElementWriter 2011-10-01 00:42:28 +00:00
Jesse Wilson
349c01e861 JsonElementWriter NaN, -Infinity, Infinity 2011-10-01 00:35:51 +00:00
Jesse Wilson
ed2b25ddef Don't serialize nulls in JsonElementWriter if setSerializeNulls(false) 2011-10-01 00:22:33 +00:00