Commit Graph

378 Commits

Author SHA1 Message Date
Jesse Wilson
cdd5d80b85 Support writing maps with non-string keys 2011-09-09 08:17:20 +00:00
Jesse Wilson
f50cce6d14 Don't call deserializers with null 2011-09-09 08:13:50 +00:00
Jesse Wilson
ee9ffa808a If the reflective type isn't as expected, fail with a JsonSyntaxException 2011-09-09 08:10:57 +00:00
Jesse Wilson
1bb48694f4 Permit the null key, which is written as "null" 2011-09-09 08:10:21 +00:00
Jesse Wilson
d22e11b184 Let the user override the byte[] type adapter 2011-09-09 08:04:28 +00:00
Jesse Wilson
2f0c617d8d Use floating point comparison for all non-integral Number types (such as LazilyParsedNumber) 2011-09-09 08:01:51 +00:00
Jesse Wilson
e756608568 Forbid custom serializers for primitive types (so we can avoid boxing in the reflective and array adapters) 2011-09-09 06:26:21 +00:00
Inderjeet Singh
fede584b98 Gson 2.0 converts JSON with type Object.class into something meaningful such as a Collection of primitives or Maps. Updated tests for the new behavior.
Changed $Gson$Types.getCollectionElementType to handle wild-card sub-classes of collections and raw collections.
2011-09-09 06:23:17 +00:00
Inderjeet Singh
6f6d3b221e Added support for constructing Queues and SortedSet while handling collections. 2011-09-09 05:49:30 +00:00
Jesse Wilson
f3c0a96f44 Support incoming nulls in all default type adapters 2011-09-09 05:46:50 +00:00
Jesse Wilson
99801915aa More code through the same fromJson path 2011-09-09 05:40:34 +00:00
Jesse Wilson
e19672d0a3 Throw the right exceptions when primitives fail to parse. 2011-09-09 05:04:24 +00:00
Inderjeet Singh
ba283925ae Deleted unneeded Long deserializer. 2011-09-09 05:02:19 +00:00
Jesse Wilson
9db0c53217 Adapt bytes 2011-09-09 04:39:29 +00:00
Inderjeet Singh
a8133efeb8 removed old-style Collections type adapter since the new one covers all cases. 2011-09-09 04:22:57 +00:00
Inderjeet Singh
ea9c0236c7 Converted InetAddress type adapter to new style. 2011-09-09 04:02:12 +00:00
Jesse Wilson
0aab1d0659 Support calling private constructors 2011-09-09 03:42:03 +00:00
Jesse Wilson
4f6a36d68f Support reading nulls into strings 2011-09-09 03:40:39 +00:00
Jesse Wilson
6029afb72d Use MiniGson's list adapters 2011-09-09 03:35:11 +00:00
Jesse Wilson
3aeb70e030 Adapter for Object.class 2011-09-09 03:31:16 +00:00
Inderjeet Singh
9fb39c89ea Switched Locale type adapter to new-style. 2011-08-26 03:14:01 +00:00
Inderjeet Singh
f9976f4b01 Switched Short, URI, URL, UUID, StringBuilder and StringBuffer type adapters to new-style. 2011-08-26 02:33:54 +00:00
Inderjeet Singh
bafc43afae removed unneeded exception catch clause. 2011-08-19 03:16:51 +00:00
Inderjeet Singh
84c71409da Removed Gson type adapters for boolean, integer, float, double, String, BigDecimal and BigInteger.
Switched Gson.fromJson() methods to use miniGson directly instead of using a DOM.
2011-08-19 03:13:06 +00:00
Joel Leitch
a85f9b81b0 Wrap IOException into a JsonIoException instead of RuntimeException. 2011-08-19 02:35:29 +00:00
Jesse Wilson
ff88ac32f2 Use MiniGSON for deserialization. 2011-08-12 18:24:20 +00:00
Joel Leitch
70965eae03 Adding new type adapters for BigInteger and BigDecimal types. 2011-08-12 02:20:48 +00:00
Inderjeet Singh
57ea7ff9f3 Restored this behavior for serialization: (as verified in CustomSerializerTest)
First preference: a type adapter registered for the runtime type
Second preference: a type adapter registered for the declared type
Third preference: reflective type adapter for the runtime type (if it is a sub class of the declared type)
Fourth preference: reflective type adapter for the declared type
2011-08-12 02:18:02 +00:00
Inderjeet Singh
f7121ad87d Restored this behavior:
If a type adapter is registered for a base class, then a field of that type is serialized with the type adapter instead of using the run-time type.
This fixes: CustomSerializerTest.testBaseClassSerializerInvokedForBaseClassFieldsHoldingSubClassInstances
2011-08-12 01:59:22 +00:00
Inderjeet Singh
ad5ff0f2d9 Created a wrapper for runtime type determination. 2011-08-05 00:41:24 +00:00
Jesse Wilson
fc99556f22 Support type exclusion strategies. 2011-08-05 00:25:49 +00:00
Inderjeet Singh
e9a971f680 Revised getRuntimeTypeIfMoreSpecific to ignore the parent and just focus on the value.
All uses of this method have already made a determination about the parent.
2011-08-05 00:13:01 +00:00
Inderjeet Singh
64dc53ffc4 Added support for runtime type determination while serializing collections and its subclasses.
This currently doesn't work since Gson register a hierarchy type adapter for Collections that takes precedence over this.
2011-08-04 23:55:52 +00:00
Jesse Wilson
e04d3fa882 Don't look for instance fields on interfaces. 2011-08-04 23:53:10 +00:00
Jesse Wilson
1885ba7dec Restore support for serializeSpecialFloatingPointValues. 2011-08-04 23:12:49 +00:00
Inderjeet Singh
6e3bf07300 Added support for runtime type determination while serializing array elements.
Created a utility class Reflection to hold methods to find Runtime type and creating new Instances.
2011-08-04 23:02:06 +00:00
Jesse Wilson
aa067056c3 Restore support for long serialization policy. 2011-08-04 22:57:36 +00:00
Inderjeet Singh
5fc2db9e72 Parity with Gson behavior where we use runtime type of an object while serializing instead of the declared type of the field. 2011-08-04 22:27:25 +00:00
Inderjeet Singh
2813385c33 Parity with Gson behavior where we use runtime type of an object while serializing instead of the declared type of the field. 2011-08-03 03:19:43 +00:00
Inderjeet Singh
5c620c7e0a Changed Gson behavior to reject duplicate fields in a class. 2011-08-03 03:05:12 +00:00
Inderjeet Singh
f1f8b666ec Implemented support for FieldNamingPolicy with MiniGson. 2011-08-03 02:51:59 +00:00
Inderjeet Singh
d70fb90ef7 Added methods to convert to JsonElement in TypeAdapter.
Using lenient mode while working with Gson.
Handling nulls while invoking legacy Gson type adapters.
2011-08-03 02:40:18 +00:00
Inderjeet Singh
566c27cf21 Adapted legacy Gson adapters into mini Gson. 2011-08-03 02:17:42 +00:00
Jesse Wilson
98aa124589 Unsafe allocation for reflective type adapters. 2011-08-03 01:25:51 +00:00
Inderjeet Singh
b922500c23 For efficiency, calling setAccessible on all fields of a class in one method call instead of doing it individually. 2011-08-03 01:25:02 +00:00
Inderjeet Singh
f276d13827 Added support for deserialization exclusion strategy. 2011-08-03 01:19:26 +00:00
Inderjeet Singh
3331dcdab0 Using serializationExclusionStrategy while navigating through fields to decide which ones to skip. 2011-08-03 00:47:36 +00:00
Jesse Wilson
37abcf3637 Break 203 tests and adopt the new stream binding internally. Test fixes coming soon... 2011-08-03 00:28:02 +00:00
Jesse Wilson
60e6ed912d Promote MiniGson to gson.internal.bind 2011-08-03 00:25:10 +00:00
Jesse Wilson
161b4babe8 Fix a pair of relatively benign off-by-one bugs. These only manifest if the source Reader returns characters one-at-a-time. 2011-07-22 15:50:26 +00:00