Commit Graph

435 Commits

Author SHA1 Message Date
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
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
194c18d20c Be backwards-compatible for serialization of maps whose keys aren't primitives. 2011-10-20 04:24:27 +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
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
Jesse Wilson
9b7b49bf0f Implement JsonElementWriter.close() 2011-10-01 00:12:36 +00:00
Inderjeet Singh
d3f927eb42 Pure refactorings:
Replaced DEFAULT_SERIALIZERS, DEFAULT_DESERIALIZERS and DEFAULT_INSTANCE_CREATORS with a single EMPTY_MAP.
Removed obsoleted TODO from Gson.
made ParameterizedTypeHandlerMap.makeUnmodifiable a builder method that returns this instance.
2011-09-30 17:56:40 +00:00
Inderjeet Singh
1621011bf2 Deleted unused CircularReferenceException 2011-09-30 17:39:46 +00:00
Inderjeet Singh
1470f20fc0 Removed unused field 2011-09-30 17:11:44 +00:00
Inderjeet Singh
47a36fd095 Fixed Eclipse warnings 2011-09-30 17:08:35 +00:00
Jesse Wilson
cf15565243 Don't round trip through strings 2011-09-30 07:24:07 +00:00
Jesse Wilson
bb7f0b6bb0 Adopt JsonElementWriter in GSON.
Add setSerializeNulls() to JsonWriter, so nulls can be skipped from serialization. This does not yet impact JsonElementWriter.

One change in behavior: if the only value is skipped, we now emit "null" rather than "".
2011-09-30 07:08:44 +00:00
Jesse Wilson
364de80611 Stream to a DOM 2011-09-30 06:32:33 +00:00
Jesse Wilson
d26c818918 New streaming writer writes to DOMs 2011-09-30 06:26:46 +00:00
Jesse Wilson
6c0566bd22 Start using JsonElementReader in TypeAdapter.
Also fix strict handling of NaN and Infinity
2011-09-30 03:47:30 +00:00
Jesse Wilson
1bb01055f0 Tests for JsonElementReader.close 2011-09-30 03:31:44 +00:00
Jesse Wilson
9ce9c62b44 Tests for JsonElementReader 2011-09-30 03:25:41 +00:00
Jesse Wilson
bd2a0ac466 Support JsonReader API on DOM objects.
This still needs test coverage & documentation but it appears to work!
2011-09-30 00:44:37 +00:00
Jesse Wilson
8b21c7770b Use the same behavior in all situations when an InstanceCreator returns a subclass.
Previously we would set the field if the created instance is being assigned to a field of another object. We wouldn't set it when the created instance is a collection element or the top-level object.
2011-09-29 16:38:24 +00:00
Jesse Wilson
46e65a77c5 Convert RuntimeTypeAdapter to a TypeAdapterFactory; this avoids the need for serializeDefault() 2011-09-28 19:14:46 +00:00
Jesse Wilson
2236c95c37 Death to serializeDefault and deserializeDefault 2011-09-28 18:00:34 +00:00
Jesse Wilson
3f26144165 Fix date adapters to work when run in any time zone. 2011-09-28 17:56:54 +00:00
Inderjeet Singh
b2d5940a9b Implemented runtime type serialization for keys and values of a map.
This fixes MoreSpecificTypeSerializationTest.testMapOfSubclassFields
2011-09-27 15:20:57 +00:00
Jesse Wilson
3b3a60d301 Use new instances of DateTypeAdapter and TimeTypeAdapter for each GSON; this guarantees that the TimeZone and Locale are what they should be 2011-09-26 21:44:08 +00:00
Inderjeet Singh
2f0fbf6bcc deleted code that didnt really do anything as there are no default old-style type adapters. 2011-09-26 17:45:06 +00:00
Inderjeet Singh
c1bac6debf Converted Date type adapter to the new style. This was the last remaining old style default type adapter. 2011-09-25 21:51:28 +00:00
Inderjeet Singh
81854db4ac Converted java.sql.Timestamp type adapter to the new style. 2011-09-25 21:35:36 +00:00
Inderjeet Singh
f9b6c2095f Converted java.sql.Time type adapter to the new style. 2011-09-23 18:42:45 +00:00
Inderjeet Singh
467011c7ab Allowed users to override default type adapters for various classes. 2011-09-20 00:27:33 +00:00
Inderjeet Singh
8217aca925 Converted java.sql.Date type adapters to the new style. 2011-09-20 00:26:37 +00:00
Inderjeet Singh
d20df34b8b Converted Calendar/GregorianCalendar type adapters to the new style. 2011-09-20 00:08:33 +00:00
Inderjeet Singh
4402240294 Converted Number type adapter to the new style. 2011-09-19 17:02:02 +00:00
Inderjeet Singh
2780a2a9bf Fixed eclipse warnings. 2011-09-16 06:03:16 +00:00
Inderjeet Singh
b5f8ef6e16 Converted CharacterTypeAdapter to the new style. 2011-09-16 05:58:41 +00:00
Inderjeet Singh
882c14a367 Added support in Gson for serializing/deserializing from primitive char.
Created a new class for character/char tests, PrimitiveCharacterTest. This is the start of breaking down PrimitiveTest into smaller chunks.
When MiniGson can not find a type adapter for a type, revised the message to say can't handle instead of can't serialize.
2011-09-16 05:52:32 +00:00
Inderjeet Singh
c71e61cf48 Converted EnumTypeAdapter to new style.
Got rid of default Hierarchy Serializer/Deserializers from DefaultTypeAdapters.
Got rid of methods for gettting default serializers/deserializers/instance creators. Instead we reuse the static final instances.
Fixed warnings in TypeAdapters where a parameterized type T was hiding the parameterized T in methods.
Removed support to unwrap single element array of enums into enum values. Also removed the test that verifies this behavior.
2011-09-16 05:40:05 +00:00