Commit Graph

169 Commits

Author SHA1 Message Date
Inderjeet Singh
6728c742d2 Updated log statements to be localizable. 2010-06-15 20:40:12 +00:00
Joel Leitch
ba0154867d Add support to allow spaces in the JSON field name. 2010-05-26 17:40:19 +00:00
Joel Leitch
9c7bfc677a Allow cache size to be configured. 2010-05-19 20:47:27 +00:00
Joel Leitch
2610a2920d Update Parser to add members to an JsonObject within a loop rather than a recursive call. 2010-05-19 20:44:27 +00:00
Joel Leitch
9816426bba Add new Cache interface and LRU Cache implementation to cache field annotations per "Class" (rather than per instance). This results in a significant speed-up (approx. 3X) when serializing/deserializing the same classes over and over again. 2010-01-10 00:32:21 +00:00
Joel Leitch
e6496fddd6 Update JavaDoc to link to the correct interface (FieldNamingStrategy2). 2010-01-09 22:48:53 +00:00
Joel Leitch
e3af076ff2 Deprecate the FieldNamingStrategy interface and replace it with FieldNamingStrategy2. This is the first step to help make it easy to cache field annotations across all instances of a class, etc. 2010-01-09 22:43:27 +00:00
Inderjeet Singh
7079799890 Fixed issue 167 by adding support for TreeSet deserialization. Added tests for serialization/deserialization of treesets. 2010-01-08 19:14:42 +00:00
Inderjeet Singh
15fa10943c Fixed serializers and deserializers for java.sql Date and Time to ensure that Date does't serialize time, and time does't serialize the date portion. 2009-12-04 18:15:00 +00:00
Inderjeet Singh
ebf24fbda5 Fixed issue 134 by adding support for java.sql Date and Timestamp classses. 2009-12-04 01:21:13 +00:00
Joel Leitch
c329d020b9 Make some fields final and initialize immediately. 2009-12-03 23:13:39 +00:00
Joel Leitch
33e816dcf0 More lazy initialization done for FieldAttributes. 2009-12-03 22:28:58 +00:00
Joel Leitch
641390b1a1 Lazily initialize fields in FieldAttributes to prevent multiple Java reflection invocations. 2009-12-03 22:17:39 +00:00
Inderjeet Singh
610580b8d9 exposed final fields of Pair for fast access. Pair is used quite a bit during serialization because of its use in ref stack. 2009-12-03 20:58:22 +00:00
Inderjeet Singh
bc1e5c5c99 Ensured that custom deserializer is invoked with actual type returned for field values.
Fixed a bug where a top-level object was constructed with default values even when the custom deserializer tried to set it to null.
2009-10-09 19:41:33 +00:00
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
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