Commit Graph

57 Commits

Author SHA1 Message Date
Joel Leitch
572421b771 Open object construction in JsonDeserializationContext to leverage the same object construction as default gson deserialization. 2011-05-20 21:50:39 +00:00
Inderjeet Singh
5bc80cd693 Moved Cache, LruCache, Pair, Primitives and UnsafeAllocator to com.google.gson and made them package private. 2011-03-30 13:59:06 +00:00
Jesse Wilson
4efb133b4a bling bling
Prefix internal classes with $ to prevent them from interfering with IDE's auto import functionality.
2011-03-29 21:24:26 +00:00
Inderjeet Singh
337d89cf3f Removed ObjectNavigatorFactory 2011-03-24 20:19:41 +00:00
Joel Leitch
861e047a62 Create an "internals" package for classes that we do not want to share, but is needed across multiple pacakges.
As well, move non-Gson specific classes, such as Preconditions, to this new "internals" package.
2011-03-21 22:30:35 +00:00
Joel Leitch
ba0cd254a9 Clean up warnings. 2011-03-15 15:38:17 +00:00
Joel Leitch
114633fbf9 Provide a means to add serialization or deserialization specific exclusion strategies. 2011-02-04 03:09:41 +00:00
Joel Leitch
56aa828350 Minor clean-up in Gson class. 2011-01-22 22:43:43 +00:00
Joel Leitch
b883f8f4aa Add new "Mode" enum and carry mode through Gson so exclusion strategies know whether it is currently serializing or deserializing.
Deprecate old ExclusionStrategy code since this new approach is more powerful.
2011-01-22 22:15:06 +00:00
Inderjeet Singh
2b9f81e8b5 Registering default type hierarchy adapters first and allow users to override them.
This allows the default EnumTypeAdapter to be overridden for a specific hierachy adapter for Enum with anonymized sub-classes.
2011-01-19 23:28:28 +00:00
Jesse Wilson
1c5f5132d8 Revert most of r677: Required strings to be quoted even in lenient mode. As far as Inderjeet and I can tell, this is consistent with Gson 1.5. 2010-11-24 23:22:13 +00:00
Joel Leitch
0a3f5fa801 Required strings to be quoted even in lenient mode.
As far as Inderjeet and I can tell, this is consistent with Gson 1.5.
2010-11-16 22:14:40 +00:00
Joel Leitch
7d055fcb51 Fixing fromJson type casting. 2010-11-11 18:22:45 +00:00
Joel Leitch
32afd1a4e4 Fixing parsing of unquoted strings to be (somewhat) consistent with previous versions of Gson. The difference with this version is that Gson will throw a more specific exception rather than JsonParseException. 2010-11-10 02:02:57 +00:00
Inderjeet Singh
10db917e93 Updated fromJson and toJson signatures to indicate the kind of exceptions (JsonIOException, JsonSyntaxException) that can be thrown. 2010-11-03 19:46:29 +00:00
Inderjeet Singh
83539c534c removed compiler warnings.
Added default serial version id for MalformedJsonException.
2010-11-03 13:28:09 +00:00
Jesse Wilson
dea7ab89fe Restore pretty printing. The pretty printing format isn't as compact as the previous format - for example arrays of integers are printed one-per-line, whereas the previous format compacted these to all sit on the same line. 2010-11-01 23:03:41 +00:00
Jesse Wilson
c8c3a6965c Fix a regression that expects different type adapters for long.class and Long.class. This is a temporary fix; later we may want to always use the canonical wrapped class. 2010-11-01 22:46:20 +00:00
Jesse Wilson
20d895ff95 Fix primitive wrapping and casting.
Issue: 235
2010-11-01 22:36:30 +00:00
Inderjeet Singh
d3eda04f33 Added support for deserializing from null input to a null value.
Added toString() method to ObjectTypePair.
2010-10-22 16:06:59 +00:00
Inderjeet Singh
91bee2a688 Throwing JsonIOException on write failures 2010-10-18 23:58:09 +00:00
Inderjeet Singh
2b1f3eec15 Removed a bunch of unused code and unnecessary else statements. 2010-09-28 13:42:43 +00:00
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
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
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
e37add7836 Implemented some code review comments from r482 2009-10-09 01:35:45 +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
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
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
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
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
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
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
b44bbbf5e7 Added an API method to create a tree of JsonElement from an object. 2009-04-03 21:33:01 +00:00
Joel Leitch
5c6d5a0d11 Remove unneeded exception handling in Gson class. 2009-04-01 19:26:10 +00:00
Inderjeet Singh
cee6c74960 incorporated code review comments from r379 by removing the catching of OutOfMemoryError and StackOverflowError in Gson.fromJson. This is obviated since JsonParser.parse catches these errors, and that was the primary source of these problems. 2009-04-01 17:15:01 +00:00
Inderjeet Singh
2034090b15 Changed version to 1.3
Made JsonParser.parse a non-static method.
2009-03-31 17:53:23 +00:00
Joel Leitch
c9cb05fc72 Do not leak out a ClassCastException to our clients. 2009-03-27 19:43:33 +00:00
Inderjeet Singh
68f3899c1a Updated the security token to make generated Json non-executable. Removed the unneeded <data> element at the end. 2009-03-20 18:02:35 +00:00
Inderjeet Singh
b2b2e5dc0a Implemented enhancement request from issue 42 by supporting a new GsonBuilder setting generateNonExecutableJson() that prefixes the generated JSON with some special text that makes the output non-executable javascript. Gson now recognizes this special text in the input while parsing the JSON in fromJson and filters it out, if present. 2009-03-17 21:15:10 +00:00
Inderjeet Singh
2c7cc620d4 Exposed API for JsonParser and added methods to Gson to deserialize from a parse tree. 2009-02-04 01:56:28 +00:00
Joel Leitch
764e4d9aca Performance fixes after doing some profiling. 2009-01-20 08:38:21 +00:00
Joel Leitch
6a80791f13 Code cleanup and some minor performance fixes. 2009-01-20 01:36:54 +00:00
Joel Leitch
458f2baa2f Added special serialization of "Long". Now the client has the ability to output a long field as a JSON "String". This is useful for JavaScript clients that need to handle long values.
As well, this change does a major clean up of the custom type adapter handling and ParameterizedTypeMap creation.
2008-12-28 03:23:36 +00:00
Joel Leitch
54a480774d Add the ability to configure Gson to exclude serializing and deserializing of all "Inner Classes". 2008-12-28 02:00:31 +00:00
Inderjeet Singh
51881c7f4a Added a GsonBuilder setting to enable serialization of special double types, NaN, Infinity, and -Infinity. 2008-12-20 01:26:14 +00:00