Commit Graph

2043 Commits

Author SHA1 Message Date
Inderjeet Singh 338758a0d3 implemented support for deserialization to deserialize to more specific type if an instance creator returns a sub-class. 2009-10-09 18:16:16 +00:00
Joel Leitch fffb204cee Removed import for java.util.Map.Entry. 2009-10-09 18:10:43 +00:00
Joel Leitch de6af4411b Minor fixes. 2009-10-09 15:43:50 +00:00
Inderjeet Singh 60ef777efc Fixed custom serilization invocation to correctly handle nulls returned by custom serializer. 2009-10-09 15:28:05 +00:00
Joel Leitch 6387c9028e Updated JavaDoc formatting 2009-10-09 15:26:34 +00:00
Joel Leitch 81e6ae25f1 Make FieldAttributes public so it can be used by public clients. 2009-10-09 03:11:16 +00:00
Joel Leitch 282ef30280 Updating JavaDoc tag to @code instead of @link. 2009-10-09 03:03:04 +00:00
Inderjeet Singh e37add7836 Implemented some code review comments from r482 2009-10-09 01:35:45 +00:00
Joel Leitch 6d60a7db1d Fixed comments from r486. 2009-10-09 00:36:22 +00:00
Inderjeet Singh 2bddd575b3 Code review changes from r476 2009-10-08 23:23:52 +00:00
Joel Leitch 93b0008486 Adding restrictions on the JsonElements to disallow Java "null"s. 2009-10-08 22:03:08 +00:00
Joel Leitch 10c39317a1 Makes ExclusionStrategy public. 2009-10-08 21:52:56 +00:00
Joel Leitch dc5922e703 Addresses comments in r481 (except for the interface change....leaving FieldAttributes as a class).
Change the exclusion order in ObjectNavigator to exclude a top-level class (if exclusion strategy suggests class should be skipped) even if it is marked with a custom (de)serializer.
2009-10-08 20:51:40 +00:00
Inderjeet Singh e9c156b016 Added inheritance tests using toJson() method as well. 2009-10-08 19:32:15 +00:00
Inderjeet Singh b634804533 Ensured that a base class custom serializer is run when the type is specified explicitly during serialization. For all other situations, ensured that the actual type of the object is taken into consideration while serializing. First a custom handler corresponding to the actual type is looked up, then a custom handler for the specified type.
Created some serialization specific tests regarding custom serializers. Revised some tests to use toJsonTree for better asserts instead of string matching.
2009-10-08 19:28:53 +00:00
Joel Leitch 839b0c2f94 Refactored exclusion strategies so that they can easily be exposed as part of the public API. 2009-10-07 09:23:14 +00:00
Joel Leitch c892738fbb Re-enabling the ' (apostrophe) escaping with valid JSON escaping. 2009-10-07 03:48:29 +00:00
Inderjeet Singh 536a968b32 Disabled escaping of single quote since it is valid for JSON (though invalid for JavaScript).
Added null checks in contexts since the custom type adapter can pass nulls.
2009-10-06 17:10:52 +00:00
Inderjeet Singh d416361ac5 Added a test to ensure Gson can use JSON fields to store type information. 2009-10-06 04:25:28 +00:00
Inderjeet Singh ae85e6cce6 A test to ensure that null values override default values when nulls are present in input Json during deserialization. 2009-10-06 01:55:44 +00:00
Inderjeet Singh 1da3ef9891 Ensured that a custom handler is not visited during deserialization.
Ensured that JsonTreeNavigator can handle null values as children of JsonObject. This is now possible since Gson exposes toJson(JsonElement) method to which the user can pass a JsonElement with null values.
2009-10-06 01:15:28 +00:00
Inderjeet Singh ff74224815 Revised equals and hashcode of ObjectTypePair to ensure reference equality of object instead of value equality. Improved JavaDocs for various 1.4 API methods. 2009-10-05 18:17:52 +00:00
Inderjeet Singh 2716d96516 Revised ancestor stack to use both object and type 2009-10-03 04:45:12 +00:00
Joel Leitch fbf834c3f6 Implemented suggests from r469 code review. 2009-10-02 20:33:37 +00:00
Joel Leitch b28864eaa0 Remove unused import. 2009-10-02 20:22:43 +00:00
Joel Leitch 25ea878f66 Add some synchronization to the JsonStreamParser to ensure that the "next" method behaves according to the API. 2009-10-02 20:21:19 +00:00
Joel Leitch 912db55ba6 Added test for hasNext on JsonStreamParser. 2009-10-02 19:39:09 +00:00
Joel Leitch 0c2106f2ff Adding test for new field naming policies from r456 code review. 2009-10-02 19:12:15 +00:00
Inderjeet Singh 40ca8b0537 Added copyright header per code review suggestion from r424 2009-10-02 18:46:56 +00:00
Inderjeet Singh 1dcdd3fb3f Implemented suggestions from code review r432 by adding a JsonNull for primitives if the value is null. 2009-10-01 22:15:53 +00:00
Inderjeet Singh c64b79c0f9 Implemented suggestions from the code review of r436: throwing NoSuchElementException in case the stream hits EOF. 2009-10-01 18:34:11 +00:00
Inderjeet Singh 3b1056c097 Renamed JsonParserAsync to JsonStreamParser as that is a more appropriate name.
Added a TODO in JsonSerializationVisitor per code review of r453.
2009-10-01 17:46:28 +00:00
Inderjeet Singh 8567fe6c10 Implementing code review comment from r428: Using Polymorphism for exclusion strategies for expose annotations. 2009-10-01 01:37:57 +00:00
Inderjeet Singh 77c2c29316 Implementing code review feedback from r454: using isFirst instead of the Stack to keep track of whether to add commas or not. 2009-10-01 00:57:55 +00:00
Inderjeet Singh fbefa59b66 changed synchronization on Date type adapter to be for the format object per code review comments on r452 2009-09-30 23:11:30 +00:00
Inderjeet Singh 907082102d Added code to ensure that circular reference situations with custom handlers are detected.
Split CircularReferenceTest out of ObjectTest.
2009-09-29 20:43:31 +00:00
Joel Leitch 933a3e5150 Allow serialization of nulls in a "List<Object>" type. 2009-09-29 20:34:35 +00:00
Joel Leitch e5ed1cc59a Added some more tests. 2009-09-29 20:24:48 +00:00
Joel Leitch e73ad007a4 Added test that serialize interfaces. 2009-09-29 19:03:49 +00:00
Joel Leitch 563cd1e8e3 Adding the "since" tag. 2009-09-29 18:52:32 +00:00
Joel Leitch ad4ff6996b Adding new default field naming policy 2009-09-29 18:44:56 +00:00
Joel Leitch 553a619ebd Allow dashes as part of the field name. 2009-09-29 18:40:08 +00:00
Inderjeet Singh e9a2a1d0f7 Fixed Issue 153 by using a stack to keep track of first elements at any level. 2009-09-29 17:52:49 +00:00
Inderjeet Singh 3e7ebf8556 Fixed issue 156.
Added support for serializing an object field (or array elements) as per its actual type.
Refactored inheritance related tests into its own test class. Added regression tests for issue 156.
2009-09-25 19:54:25 +00:00
Inderjeet Singh 19ae6c0763 Fixed issue 162 by making default date adapter thread-safe by synchronizing serialize() and deserialize() methods. 2009-09-25 17:14:48 +00:00
Joel Leitch 8297437610 Reverting r499. 2009-09-23 19:25:50 +00:00
Joel Leitch 0e17041c8b Added another test to JsonParserTest. 2009-09-23 19:21:09 +00:00
Joel Leitch c6f762f36b Fix Warnings 2009-09-23 19:09:01 +00:00
Joel Leitch b0f50bb4be Return a "JsonNull" object for empty whitespace input into the JsonParser. 2009-09-23 19:00:05 +00:00
Inderjeet Singh fdcd3945c5 Fixed issue 147.
Integral values (byte, short, integer, long, BigInteger) are now comparable to each other.
Floating point values (float, double, BigDecimal) are now comparable to each other.
2009-09-23 18:54:01 +00:00