Commit Graph

146 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Joel Leitch
50eb582657 Ensure that the JsonElement.toString() will always generate valid JSON (even when control characters/whitespace characters are used). 2009-09-23 18:28:03 +00:00
Inderjeet Singh
3b0f8f4340 Removed all the JDK warnings about unused fields in test classes or unused constructors for use by Gson or instanceof calls on parameterized types. 2009-09-23 17:45:16 +00:00
Inderjeet Singh
29ab864b2f Fixed bug 158 2009-09-23 17:17:03 +00:00
Joel Leitch
c5812bb485 Fixed Incorrect JavaDoc 2009-09-22 19:10:53 +00:00
Joel Leitch
18b301dfeb - Serializing of Object arrays.
- Fixed incorrect warning
2009-09-22 19:04:27 +00:00
Inderjeet Singh
82771f006c removed Java 1.5 warnings 2009-08-31 17:51:47 +00:00
Inderjeet Singh
66649a1a62 Moved ancestor tracking into the serialization visitor. Deserialization process doesn't need ancestor tracking since JSON does not allow self-referential structures. 2009-08-31 16:38:50 +00:00
Inderjeet Singh
cbcf7defa3 Updated Grammar for matching JsonArray to be left-associative rather than right-associative. Gson can now parse arrays of size over 11MB instead of 80KB which was the prior limit. Thanks for the tip, kenotron. 2009-08-22 01:03:27 +00:00
Inderjeet Singh
c13fc568c7 Fixed indentation and simplified equals method as per code review comments on r419 2009-08-18 18:07:25 +00:00
Inderjeet Singh
f4f596ec3d Made JsonParser implement Iterator 2009-08-12 21:01:42 +00:00
Inderjeet Singh
b7cbfc5c34 Fixed Issue 141 by adding new APIs for writing out JSON string representation for JsonElements. 2009-08-07 20:58:41 +00:00
Inderjeet Singh
64172d1dac Added support to serialize and deserialize array of java.lang.Object when the content is a primitive type. 2009-07-27 23:24:23 +00:00
Inderjeet Singh
4f0728f6a0 Fixed issue 126 by ensuring that parameterized type deduction is not done for transient fields. 2009-06-02 18:02:15 +00:00
Inderjeet Singh
6d50bcea87 Added serialize and deserialize parameters to the Expose annotation that control whether a field gets exposed during serialization or deserialization. 2009-05-19 23:47:53 +00:00
Joel Leitch
376385ac0e Add a single quote to the HTML set of characters that should be escaped. 2009-05-19 19:49:25 +00:00
Joel Leitch
cd9bd71092 Allow JS Keywords as field name. These names are quoted anyways (and are valid according to the JSON spec) so it should not cause any issues. 2009-05-19 17:59:32 +00:00
Joel Leitch
abf4ab2d78 Fix project so it still compiles with JDK 1.5. 2009-05-19 17:51:02 +00:00
Inderjeet Singh
6e59e502c2 Refactored the Async parser interface out of JsonParser into a new class JsonParserAsync. Updated the JsonParser to detect Eof and return a null instead of throwing a ParseException. 2009-05-14 20:18:45 +00:00
Inderjeet Singh
0127891081 Added a new API method in JsonParser to allow reading of multiple JSON objects on a stream asynchronously. 2009-05-08 22:22:34 +00:00
Inderjeet Singh
b44bbbf5e7 Added an API method to create a tree of JsonElement from an object. 2009-04-03 21:33:01 +00:00
Inderjeet Singh
f418ab69a2 Implementing hashcode and equals for JsonPrimitives as value type equality. 2009-04-03 21:24:38 +00:00