Commit Graph

99 Commits

Author SHA1 Message Date
Eric Cochran
d8d8ccb98a Simplify maintainType logic
When we maintain the label value, we do not need to make a new JsonObject and copy over the keys and values when writing. The ordering will change, though. Before this change, it always put the label first.
2018-07-30 13:43:52 -04:00
lucalas
c1e7e2d280 Add possibility to maintain type variable in created pojo (#1342)
Instead of completely remove type variable, give the possibility to decide if maintain type value (if pojo has type variable declaration) or not.
2018-07-20 14:34:45 -07:00
Stefan M
1c09b3f928 Fix well formed exception (#1105)
The previous exception was styled in the following way:
... ["DATE']...
This commit will fix the different quote marks and replace the " with '
2017-06-23 09:32:04 -07:00
Niv Singer
74e37110e5 Avoid NPE in PostConstructAdapterFactory (#1103)
* Avoid NPE in PostConstructAdapterFactory

The RawType's Superclass might be null. This happens, for example, when the type is a collection.

* Add test case for NPE in PostConstructAdapterFactory

* Improve the code quality of PostConstructAdapterFactoryTest

* Improve the code quality of PostConstructAdapterFactoryTest

* Improve the code quality of PostConstructAdapterFactoryTest
2017-06-19 18:04:19 -07:00
Inderjeet Singh
4512f31c69 Added PostConstruct Factory sample in Extras. 2016-09-16 17:35:34 -07:00
Juan Andrés Diana
86d88c32cf The method registerTypeAdapterFactory accepts a TypeAdapterFactory instance only. 2016-05-25 15:49:39 -03:00
Juan Andrés Diana
d4a9eb4e7b Docs fix for the RuntimeTypeAdapterFactory class.
Instances of classes that implement RuntimeTypeAdapterFactory should be registered using the registerTypeAdapterFactory method instead of registerTypeAdapter.
2016-05-24 16:45:55 -03:00
Egor N
edaf59e178 Fix RuntimeTypeAdapterFactory javadoc 2016-02-19 16:14:55 +02:00
Lachlan Coote
1867457030 fix #680 - make RuntimeTypeAdapterFactory null-safe 2015-08-05 16:27:18 -07:00
Inderjeet Singh
0c3b9670f0 Ensuring that UTC date adapter serializes nulls correctly 2014-12-05 22:12:54 +00:00
Inderjeet Singh
f0f9ce42f4 using only Jackson iso8601 implementation for UTC date adapter 2014-12-05 08:28:25 +00:00
Inderjeet Singh
0e3708be82 updated UTC type adapter to support JDK 1.6 using Jackson ISO8601 parsing util 2014-12-05 07:41:08 +00:00
Inderjeet Singh
255f2e2847 added a sample Date type adapter for UTC 2014-12-05 00:16:24 +00:00
Inderjeet Singh
1d9e86e27c fixed extras build 2014-12-04 22:07:13 +00:00
Jesse Wilson
af4879dbb7 Move interceptors from 'alpha' to 'extras'.
This makes the feature less risky to use! It now uses our
TypeAdapterFactory infrastructure rather than relying on
parallel infrastructure.
2012-10-23 17:36:30 +00:00
Inderjeet Singh
42e35e9f90 updated oss-parent version to 7 in gson-extras pom.
fixed some eclipse warnings.
2012-08-01 20:57:51 +00:00
Inderjeet Singh
982c893d65 updated extras pom to latest plugin versions.
updated organization names for Jesse and Inder.
2012-08-01 20:54:37 +00:00
Inderjeet Singh
7a5cef9305 Revised to the new name getDelegateAdapter. 2012-04-14 19:04:14 +00:00
Jesse Wilson
2e6b22fa2e Test that GraphAdapterBuilder works with multiple entity types. 2012-01-01 15:57:29 +00:00
Jesse Wilson
efde6674e1 Test that GraphAdapterBuilder works with collections. 2012-01-01 15:48:01 +00:00
Jesse Wilson
6cca23c172 Get GraphAdapterBuilder working for serialization and deserialization using InstanceCreators to get a sneak peek at a value under construction. 2012-01-01 13:42:44 +00:00
Jesse Wilson
796a381279 Kill GsonInternalAccess. Clients to this were all broken because nobody was ever assigning INSTANCE. 2012-01-01 12:42:20 +00:00
Inderjeet Singh
6c78bf5247 made toJson/fromJson/toJsonTree methods public in TypeAdapter.
made Gson.getNextAdapter method public.
2011-12-31 08:52:59 +00:00
Jesse Wilson
ecdf9150f6 Hide Gson.getNextAdapter() for the current release. 2011-12-31 05:30:40 +00:00
Jesse Wilson
4057b98bab Implement all but the most difficult part of graph type adapter's deserialization. The catch is we want to return an instance that we don't have yet. It's on the stack, but we don't have a handle to it because it's inside the 'nextTypeAdapter' who is busy populating its fields. 2011-12-30 08:27:24 +00:00
Jesse Wilson
6ec6caa49d New extension: handle circular references.
Serialize graphs of objects by assigning each instance a generated ID and writing the complete graph out as a list. The output for a cycle of Rock/Scissors/Paper looks like this:

{
  '0x1':{'name':'ROCK','beats':'0x2'},
  '0x2':{'name':'SCISSORS','beats':'0x3'},
  '0x3':{'name':'PAPER','beats':'0x1'}
}

This is work towards issue 137. The hard part is going to be deserializing that back into a graph.
2011-12-30 07:34:43 +00:00
Jesse Wilson
bcaf56079c Register runtime type adapters using the proper factory-specific APIs. 2011-12-30 06:55:56 +00:00
Jesse Wilson
d7fbac0384 Rename TypeAdapter.Factory to TypeAdapterFactory. 2011-12-23 18:27:13 +00:00
Inderjeet Singh
1c850dc3ea updated to Gson 2.1-SNAPSHOT 2011-12-22 21:22:42 +00:00
Jesse Wilson
dce4e463d9 Apply variable name improvement from issue 385.
Fixes issue 385.
2011-12-16 04:55:54 +00:00
Jesse Wilson
f602bce9f5 Nice documentation for TypeAdapter. 2011-12-03 19:46:25 +00:00
Jesse Wilson
26ab404599 Cleanup names for TypeAdapters. 2011-12-02 22:57:30 +00:00
Jesse Wilson
f39ac8d946 Update extras to build after today's Gson/MiniGson refactoring. 2011-11-21 05:09:14 +00:00
Jesse Wilson
b892c85909 Sync RuntimeTypeAdapterFactory to recent internal API changes 2011-10-19 17:49:02 +00:00
Jesse Wilson
46e65a77c5 Convert RuntimeTypeAdapter to a TypeAdapterFactory; this avoids the need for serializeDefault() 2011-09-28 19:14:46 +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
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
041d499a7c Fix serialization where one type depends (possibly indireclty) on itself! 2011-07-12 19:39:27 +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
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
Jesse Wilson
9ad3358728 Document RuntimeTypeAdapter 2011-06-06 05:40:13 +00:00
Jesse Wilson
3d50a6b72a New failing test for RuntimeTypeAdapters! 2011-05-27 18:47:31 +00:00
Inderjeet Singh
3e324cc8a4 Added an example of using raw collection for serialization and deserialization with Gson. 2011-05-27 18:33:03 +00:00
Jesse Wilson
d93825ba72 First draft of RuntimeTypeAdapters 2011-05-14 02:04:17 +00:00
Inderjeet Singh
78327b95ee initial checkin for the extras project 2011-05-13 18:30:20 +00:00