Commit Graph

626 Commits

Author SHA1 Message Date
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
Jesse Wilson
415437810a Include line and column position in error messages. 2011-07-18 19:26:02 +00:00
Jesse Wilson
4b042671af Cleanup after experimenting with specializing BoundField by type (ie. Field.setInt() to avoid autoboxing) 2011-07-15 14:37:05 +00:00
Jesse Wilson
3c4d121dc8 Fix integration tests that fell out from some benchmarking. 2011-07-15 13:43:52 +00:00
Jesse Wilson
9cf579ef01 Use Streams instead of Escaper.
Fixes issue 345.
2011-07-12 23:50:00 +00:00
Jesse Wilson
041d499a7c Fix serialization where one type depends (possibly indireclty) on itself! 2011-07-12 19:39:27 +00:00
Jesse Wilson
d3a4b48ad9 Unconditionally escape unicode newline characters.
Fixes issue 341.
2011-07-12 16:05:22 +00:00
Joel Leitch
7dca724292 Fixing import order. 2011-07-12 04:15:46 +00:00
Jesse Wilson
c6bef30057 Array support. 2011-07-11 22:26:53 +00:00
Jesse Wilson
95a345234f MiniGSON Map adapters and support for nulls. 2011-07-11 21:45:09 +00:00
Jesse Wilson
c5f1df1017 MiniGSON prototype! 2011-07-11 16:46:52 +00:00
Jesse Wilson
807aa97ee7 Don't use ambiguous timezone names.
Fixes bug 331.
2011-07-01 22:00:45 +00:00
Inderjeet Singh
edf9be298c fixed issue 339 2011-07-01 21:59:36 +00:00
Jesse Wilson
937019651a Trailing comma tests 2011-07-01 21:36:05 +00:00
Inderjeet Singh
62675b7f46 Added serializeDefault and deserializeDefault methods in contexts that only invoke system type adapters on the top-level object.
With this, the RuntimeTypeAdapterTest passes.
2011-07-01 21:29:20 +00:00
Inderjeet Singh
5f4e88f62a More tests to ensure that serialization works for parameterized types like A<B<C<D>>> without the need to specify type in toJson() 2011-06-25 20:14:09 +00:00
Inderjeet Singh
d347128e6f Implemented support for serializing objects of type Bar<Foo> without the need to specify their type explicitly in toJson method. 2011-06-25 20:04:14 +00:00
Inderjeet Singh
ef2f73180b added tests to illustrate and validate that Gson can serialize parameterized types without the need of explicit type token. 2011-06-25 19:43:05 +00:00
Inderjeet Singh
9196b23251 Refactoring: Separated type handler maps into two types: one for system-specified handlers and one for user-specified. system-specified handlers are the ones that Gson comes with (DefaultTypeAdapters). 2011-06-24 21:52:59 +00:00