Commit Graph

644 Commits

Author SHA1 Message Date
Jesse Wilson
9424949245 Don't unwrap single-element String arrays 2011-09-09 05:41:35 +00:00
Jesse Wilson
99801915aa More code through the same fromJson path 2011-09-09 05:40:34 +00:00
Jesse Wilson
da67003eef GSON 1.x uses arbitrary precision for primitive type conversion (so -122.08e-2132 != 0)
GSON 2.x uses double precision (so -122.08e-2132 == 0)
2011-09-09 05:23:01 +00:00
Jesse Wilson
a7e9ac3612 Don't support oversized values like 30-character integers 2011-09-09 05:11:59 +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
Jesse Wilson
f67940cb63 Retire two old bad features
- overriding primitive type adapters
 - auto unwrapping of single element arrays
2011-09-09 04:20:25 +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
9b6954decd Additional tests to verify handling of bytes. 2011-08-26 01:11:50 +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
759eb8ede5 Factory always wanted to be public. 2011-08-03 00:17:17 +00:00
Inderjeet Singh
f127398ad1 Made the proguard example work by using -keepattributes Signature (as advised in https://sourceforge.net/tracker/?func=detail&aid=3375947&group_id=54750&atid=474704) 2011-07-25 06:23:02 +00:00
Inderjeet Singh
a85807818f Invoking Gson toJson and fromJson with-in the Android application.
Gson.fromJson does not currently work in this application with proguard enabled: The reason seems to be that Cart's field List<LineItem> gets rewritten as raw List type.
2011-07-23 01:08:34 +00:00
Inderjeet Singh
ea4cfcd4b9 initial cut at an example Android application that uses Proguard with Gson 2011-07-22 20:55:37 +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
Jesse Wilson
befcfd908b Skip a byte order mark (BOM) if it exists.
http://code.google.com/p/android/issues/detail?id=18508
2011-07-20 18:57:30 +00:00