Commit Graph

462 Commits

Author SHA1 Message Date
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
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
9cf579ef01 Use Streams instead of Escaper.
Fixes issue 345.
2011-07-12 23:50:00 +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
807aa97ee7 Don't use ambiguous timezone names.
Fixes bug 331.
2011-07-01 22:00:45 +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
Jesse Wilson
f74dffc6fd Add deepCopy to JsonArray and JsonObject.
Resolves issue 301.
2011-06-17 21:46:28 +00:00
Joel Leitch
aa89773008 Quick fix for threading issue. Should maybe look into synchronizing this method instead. 2011-06-07 01:28:30 +00:00
Joel Leitch
533ea1755d Fix typo 2011-06-03 19:05:53 +00:00
Joel Leitch
c9ee7adcc5 Start using JsonNull.INSTANCE everywhere and remove creation method. 2011-06-03 19:02:28 +00:00
Inderjeet Singh
8fd4072f9b fixed javadocs 2011-06-03 19:01:08 +00:00
Inderjeet Singh
60e7c481fd Added complex map serialization tests in case the Map is defined with TypeVariables. 2011-05-30 09:38:38 +00:00
Inderjeet Singh
61b9a2cb17 Moved field creation to the field declaration to avoid inadvertent change from LinkedHashMap to something else. 2011-05-30 09:01:45 +00:00
Inderjeet Singh
9531c662da suppressed deprecation warning. 2011-05-30 06:47:21 +00:00
Inderjeet Singh
44faec1eb1 removed the methods that return null for various getAs methods per discussions with Jesse and Joel. 2011-05-27 17:58:39 +00:00
Inderjeet Singh
e79bcde8bf Using JsonNull.INSTANCE instead of JsonNull.createJsonNull() method 2011-05-25 16:55:57 +00:00
Inderjeet Singh
f2eb76eac9 removed deprecation warnings by using JsonNull.INSTANCE 2011-05-25 16:48:39 +00:00
Inderjeet Singh
5d31558428 eliminated maven compilation problems with JDK 5 2011-05-25 16:13:36 +00:00
Inderjeet Singh
540d36e4bd API Change: Implemented various getAs methods to return null. 2011-05-25 07:08:21 +00:00
Inderjeet Singh
5e2bc1b8f0 New Public API: Exposed the singleton instance for JsonNull. 2011-05-25 07:01:36 +00:00
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
b85daafb08 suppressed unchecked warning 2011-05-11 21:43:47 +00:00
Inderjeet Singh
0bcd1b341f Revised Gson to refuse to deserialize floating point numbers into integer types.
This is probably a break from the past: previous versions of Gson allowed truncating a floating point into a long or int. However, it wasn't consistent in this behavior. It disallowed converting a BigDecimal value into BigInteger, int or long. Refusing to deserialize such values is aligned with fail-fast approach of uncovering bugs.
2011-05-04 23:26:22 +00:00
Jesse Wilson
ce79e16f7a StringPooling. This makes things up to 20% faster on dalvikvm for some data sets. 2011-04-28 22:08:06 +00:00
Inderjeet Singh
824635158c Parsing numbers lazily as a performance enhancement.
This avoids needing to parse number if the equivalent object field doesn't exist.
It also avoids the performance penalty of trying to parse it eagerly as a big decimal, float etc.
2011-04-28 21:57:29 +00:00
Joel Leitch
4efeef1893 Make test a little more complex to show it actually fixed the bug. 2011-04-20 22:32:13 +00:00
Joel Leitch
f291c4d33e Fix a bunch of preserve-type issues:
- Issue 205
- Issue 294
- Issue 318
2011-04-20 22:27:51 +00:00
Joel Leitch
cf3615e38c Adding tests to verify 294. 2011-04-19 22:18:25 +00:00
Inderjeet Singh
e60274ed35 Added tests to ensure that subclass objects that are of a parameterized type are serialized per their declared type in lists or maps. 2011-04-19 20:49:48 +00:00