Jesse Wilson
747e3c3051
Support mixed streaming and databinding with new APIs.
2010-09-02 00:15:23 +00:00
Jesse Wilson
fa40b4c63a
Rename GsonReader to Streams; check that class in.
2010-09-02 00:10:02 +00:00
Jesse Wilson
486820f515
Fix some test problems.
...
JsonWriter was using suboptimal escape characters for newlines etc: unicode escapes rather than \x escapes.
JsonObjectTest was banning empty and whitespace-only keys. These values are permitted as of r585.
2010-08-28 08:18:13 +00:00
Jesse Wilson
ff7aa3f331
Escape only the required characters when emitting JSON. This means that instead of emitting
...
["foo\nbar", "baz"]
we'll emit this:
["foo
bar", baz"]
This simple change measured about ~35% faster for in-memory writes!
2010-08-28 07:29:22 +00:00
Jesse Wilson
7e1e4eab07
Remove the constraint that map keys mustn't be the empty string.
...
See bug 227.
2010-08-28 05:02:33 +00:00
Jesse Wilson
d5741b321f
Don't exclude enum constants, even if they are anonymous.
...
See issue 226.
2010-08-27 07:26:35 +00:00
Jesse Wilson
7a7bbf754c
Use JsonReader internally rather than JsonParserJavacc.
...
For raw parsing (ie. new JsonParser().parse()) the parse time has improved substantially. For example, JsonParserJavacc parsed my 48KiB buzz feed in 4.8ms. JsonReader parses the same feed in 0.9ms.
http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.gson.GsonBenchmark/430001
2010-08-27 05:59:18 +00:00
Jesse Wilson
765a9f1ecd
Brand new classes for streaming JSON efficiently.
...
Notable features:
- Efficiency. The parser is faster than the current javacc parser. It's also faster than popular libraries for JSON streaming.
- Toggle lenient/strict
- Toggle pretty/compact
- Friendly error messages on bad JSON
- GSON-quality Javadoc
- Non-execute prefix handling
This doesn't wire JsonReader up into Gson just yet. That's coming soon...
2010-08-26 08:44:02 +00:00
Joel Leitch
5bffa1f679
Fix for Issue 178.
2010-08-21 06:50:52 +00:00
Inderjeet Singh
de0f8da151
replaced unchecked suppressed warnings token with more specific rawtypes.
...
removed unused imports.
2010-08-20 16:27:46 +00:00
Inderjeet Singh
ed838ec104
replaced unchecked suppressed warnings token with more specific rawtypes
2010-08-20 16:20:37 +00:00
Inderjeet Singh
24fd66f645
removed @since for non-public classes
2010-08-20 00:35:48 +00:00
Inderjeet Singh
dc60cb1931
Made FieldNamingStrategy2 is package protected class.
...
Made type hierarchy adapter registration package protected.
Marked some of the classes final.
Minor changes in the performance tests.
2010-08-19 00:10:42 +00:00
Joel Leitch
89c18452ae
Ensure date with pattern is not override with the "default" date type adapter when a custom JsonSerializer/JsonDeserializer is registered.
2010-08-18 23:58:52 +00:00
Inderjeet Singh
b2af57d288
Added checks to ensure that typeHierarchyAdapter being registered doesn't hide a previously existing one.
...
Fixed a bug where registerIfAbsent was adding type adapters in the reverse order of priority.
Added toString() to Pair.
2010-06-24 21:51:18 +00:00
Inderjeet Singh
8aedbc84db
Added a new GsonBuilder option to register a type adapter for a type hierarchy instead of a single type.
...
Upgraded Gson version to 1.5 since a new API call is being added.
2010-06-21 23:26:06 +00:00
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