Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JsonSerializer/JsonDeserializer in the JsonAdapter annotation #873

Merged
merged 4 commits into from Jun 14, 2016

Conversation

inder123
Copy link
Collaborator

No description provided.

Inderjeet Singh and others added 3 commits June 2, 2016 00:08
…otation.

JsonAdapter is cached per the type of the JsonAdapter class.
Added a test to ensure JsonAdapter works on fields of parameterized types
Keep track of registered JsonAdapters and JsonAdapterFactorys in ThreadLocal.
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@inder123
Copy link
Collaborator Author

This pull request is a carry forward from #821

@inder123
Copy link
Collaborator Author

confirmed

@inder123
Copy link
Collaborator Author

confirmed

On Fri, Jun 10, 2016 at 5:44 PM, googlebot notifications@github.com wrote:

We found a Contributor License Agreement for you (the sender of this pull
request) and all commit authors, but as best as we can tell these commits
were authored by someone else. If that's the case, please add them to this
pull request and have them confirm that they're okay with these commits
being contributed to Google. If we're mistaken and you did author these
commits, just reply here to confirm.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#873 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABCwyhUFLHY4Vt5A7TaOluE0ykmybrnSks5qKgUBgaJpZM4Izbo3
.

http://www.singhinderjeet.com/

@swankjesse
Copy link
Collaborator

@googlebot these commits are mine; I approve.

@@ -245,10 +246,11 @@ public Gson() {
// type adapters for composite and user-defined types
factories.add(new CollectionTypeAdapterFactory(constructorConstructor));
factories.add(new MapTypeAdapterFactory(constructorConstructor, complexMapKeySerialization));
factories.add(new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor));
this.jsonAdapterFactory = new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we initialize this way up with all the other fields?

Copy link
Collaborator Author

@inder123 inder123 Jun 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont understand what you mean. But we can do that in another pull request, I will go ahead and merge this now.

@JakeWharton
Copy link
Contributor

LGTM

@inder123
Copy link
Collaborator Author

merging per LGTM.
Great feedback overall, guys! Tiresome but rigorous process. 👍

@inder123 inder123 merged commit b2c00a3 into master Jun 14, 2016
@inder123 inder123 deleted the jwilson.0601.get_delegate_adapter branch June 14, 2016 23:37
testcenter added a commit to testcenter/gson that referenced this pull request Jun 20, 2016
commit 7ba2b1c
Merge: 04f1527 f482f4a
Author: testcenter <lucas.gruenberger@gmail.com>
Date:   Wed Jun 15 08:40:00 2016 +0200

    Merge remote-tracking branch 'upstream/master'

    Conflicts:

gson/src/main/java/com/google/gson/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java

commit f482f4a
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 17:22:32 2016 -0700

    ChangeLog for 2.7

commit 28c8e1c
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 17:07:51 2016 -0700

    Updated to 2.7

commit 0a29fcf
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:52:32 2016 -0700

    [maven-release-plugin] prepare for next development iteration

commit 9722b00
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:52:28 2016 -0700

    [maven-release-plugin] prepare release gson-parent-2.7

commit 86765d2
Merge: b2c00a3 687ddb3
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 16:46:57 2016 -0700

    Merge pull request google#875 from google/gson_2.7

    Preparing 2.7-SNAPSHOT to cut the 2.7 release.

commit 687ddb3
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:39:19 2016 -0700

    Preparing 2.7-SNAPSHOT to cut the 2.7 release.

commit b2c00a3
Merge: c24af30 1f859ec
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 16:37:14 2016 -0700

    Merge pull request google#873 from
google/jwilson.0601.get_delegate_adapter

    Add support for JsonSerializer/JsonDeserializer in the JsonAdapter
annotation

commit 1f859ec
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:34:34 2016 -0700

    addressed code review comments.

commit c24af30
Merge: 5f63fce c2fae85
Author: Jesse Wilson <jesse@swank.ca>
Date:   Thu Jun 9 23:32:24 2016 -0700

    Merge pull request google#871 from google/jw/tree-json-path

    Implement JSON Path for JsonTreeReader.

commit 5f63fce
Merge: ebad966 c16be41
Author: Jesse Wilson <jesse@swank.ca>
Date:   Thu Jun 9 23:06:50 2016 -0700

    Merge pull request google#872 from google/jw/object-size

    Expose JsonObject size.

commit c16be41
Author: Jake Wharton <jw@squareup.com>
Date:   Fri Jun 10 00:46:32 2016 -0400

    Expose JsonObject size.

commit c2fae85
Author: Jake Wharton <jw@squareup.com>
Date:   Fri Jun 10 00:08:33 2016 -0400

    Implement JSON Path for JsonTreeReader.

commit ebad966
Merge: 86ccf82 ecaa571
Author: inder123 <inder123@gmail.com>
Date:   Thu Jun 9 15:26:10 2016 -0700

    Merge pull request google#870 from google/jw/reader-location

    Consolidate location and path rendering for exceptions.

commit ecaa571
Author: Jake Wharton <jw@squareup.com>
Date:   Thu Jun 9 18:02:36 2016 -0400

    Consolidate location and path rendering for exceptions.

commit 86ccf82
Merge: daa92e3 3f8726e
Author: jwilson <jwilson@squareup.com>
Date:   Thu Jun 2 09:20:06 2016 -0400

    Merge branch 'deyboy90-master'

    * deyboy90-master:
      Enhancing the json reader, adding corresponding test case for it

commit 3f8726e
Author: Archit Dey <deyboy90@gmail.com>
Date:   Mon May 23 00:47:02 2016 -0700

    Enhancing the json reader, adding corresponding test case for it

commit 2df6550
Author: jwilson <jwilson@squareup.com>
Date:   Thu Jun 2 00:18:03 2016 -0400

    Don't use ThreadLocals for @JsonAdapter factories and
getDelegateAdapter().

commit 943c674
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue May 31 10:14:24 2016 -0700

    Removed ThreadLocal for activeJsonAdapterClasses

commit 45511fd
Author: Inderjeet Singh <inder@peel.com>
Date:   Wed May 18 18:21:39 2016 -0700

    Added support for JsonSerializer/JsonDeserializer for JsonAdapter
annotation.
    JsonAdapter is cached per the type of the JsonAdapter class.
    Added a test to ensure JsonAdapter works on fields of parameterized
types
    Keep track of registered JsonAdapters and JsonAdapterFactorys in
ThreadLocal.

commit daa92e3
Merge: 854760e 86d88c3
Author: Jake Wharton <jakewharton@gmail.com>
Date:   Wed May 25 15:10:18 2016 -0400

    Merge pull request google#865 from juandiana/runtimetypeadapterfactory-
docs-fix

    Fix registerTypeAdapterFactory method usage

commit 86d88c3
Author: Juan Andrés Diana <juandiana@gmail.com>
Date:   Wed May 25 15:49:39 2016 -0300

    The method registerTypeAdapterFactory accepts a TypeAdapterFactory
instance only.

commit 854760e
Merge: 2360cfa d4a9eb4
Author: inder123 <inder123@gmail.com>
Date:   Tue May 24 13:58:21 2016 -0700

    Merge pull request google#864 from juandiana/runtimetypeadapterfactory-
docs-fix

    Minor documentation fix on RuntimeTypeAdapterFactory

commit d4a9eb4
Author: Juan Andrés Diana <juandiana@gmail.com>
Date:   Tue May 24 16:45:55 2016 -0300

    Docs fix for the RuntimeTypeAdapterFactory class.
    Instances of classes that implement RuntimeTypeAdapterFactory should
be registered using the registerTypeAdapterFactory method instead of
registerTypeAdapter.

commit 2360cfa
Merge: bb451ea 2928b3e
Author: inder123 <inder123@gmail.com>
Date:   Mon May 23 23:17:54 2016 -0700

    Merge pull request google#863 from nykolaslima/explicit-null-in-json

    handle explicit null values in JSON

commit 2928b3e
Author: Nykolas Lima <nykolas.lima@gmail.com>
Date:   Mon May 23 16:44:30 2016 -0300

    handle explicit null values in JSON

commit bb451ea
Merge: ecda358 3ff16c3
Author: Jesse Wilson <jesse@swank.ca>
Date:   Tue May 17 17:26:52 2016 -0400

    Merge pull request google#832 from google/831

    Ensuring that JsonAdapter annotation works correctly for primitive
fi…

commit 3ff16c3
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue May 17 13:30:59 2016 -0700

    Don't use a runtime wrapper if a JsonAdapter annotation is present
on a field.

    This ensures that JsonAdapter annotation works correctly on a
primitive field.
    This is a potentially backward incompatible change.

commit ecda358
Merge: 0f80936 61f83d6
Author: Jesse Wilson <jesse@swank.ca>
Date:   Tue May 17 07:38:50 2016 -0400

    Merge pull request google#857 from google/jdk16_regression

    Replaced a JDK 1.7 specific method with its JDK 1.6 equivalent.

commit 61f83d6
Author: Inderjeet Singh <inder123@gmail.com>
Date:   Tue May 17 01:03:00 2016 -0700

    Replaced a JDK 1.7 specific method with its JDK 1.6 equivalent.

commit 0f80936
Merge: c101e31 c414b36
Author: Jake Wharton <jakewharton@gmail.com>
Date:   Thu May 12 08:57:34 2016 -0700

    Merge pull request google#853 from Baschdl/patch-1

    Corrected documentation, copy&paste error

commit c414b36
Author: Baschdl <sebastian@salzreute.de>
Date:   Thu May 12 14:47:03 2016 +0200

    Corrected documentation, copy&paste error
testcenter added a commit to testcenter/gson that referenced this pull request Jun 20, 2016
Squashed commit of the following:

commit 7ba2b1c
Merge: 04f1527 f482f4a
Author: testcenter <lucas.gruenberger@gmail.com>
Date:   Wed Jun 15 08:40:00 2016 +0200

    Merge remote-tracking branch 'upstream/master'

    Conflicts:

gson/src/main/java/com/google/gson/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java

commit f482f4a
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 17:22:32 2016 -0700

    ChangeLog for 2.7

commit 28c8e1c
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 17:07:51 2016 -0700

    Updated to 2.7

commit 0a29fcf
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:52:32 2016 -0700

    [maven-release-plugin] prepare for next development iteration

commit 9722b00
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:52:28 2016 -0700

    [maven-release-plugin] prepare release gson-parent-2.7

commit 86765d2
Merge: b2c00a3 687ddb3
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 16:46:57 2016 -0700

    Merge pull request google#875 from google/gson_2.7

    Preparing 2.7-SNAPSHOT to cut the 2.7 release.

commit 687ddb3
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:39:19 2016 -0700

    Preparing 2.7-SNAPSHOT to cut the 2.7 release.

commit b2c00a3
Merge: c24af30 1f859ec
Author: inder123 <inder123@gmail.com>
Date:   Tue Jun 14 16:37:14 2016 -0700

    Merge pull request google#873 from
google/jwilson.0601.get_delegate_adapter

    Add support for JsonSerializer/JsonDeserializer in the JsonAdapter
annotation

commit 1f859ec
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue Jun 14 16:34:34 2016 -0700

    addressed code review comments.

commit c24af30
Merge: 5f63fce c2fae85
Author: Jesse Wilson <jesse@swank.ca>
Date:   Thu Jun 9 23:32:24 2016 -0700

    Merge pull request google#871 from google/jw/tree-json-path

    Implement JSON Path for JsonTreeReader.

commit 5f63fce
Merge: ebad966 c16be41
Author: Jesse Wilson <jesse@swank.ca>
Date:   Thu Jun 9 23:06:50 2016 -0700

    Merge pull request google#872 from google/jw/object-size

    Expose JsonObject size.

commit c16be41
Author: Jake Wharton <jw@squareup.com>
Date:   Fri Jun 10 00:46:32 2016 -0400

    Expose JsonObject size.

commit c2fae85
Author: Jake Wharton <jw@squareup.com>
Date:   Fri Jun 10 00:08:33 2016 -0400

    Implement JSON Path for JsonTreeReader.

commit ebad966
Merge: 86ccf82 ecaa571
Author: inder123 <inder123@gmail.com>
Date:   Thu Jun 9 15:26:10 2016 -0700

    Merge pull request google#870 from google/jw/reader-location

    Consolidate location and path rendering for exceptions.

commit ecaa571
Author: Jake Wharton <jw@squareup.com>
Date:   Thu Jun 9 18:02:36 2016 -0400

    Consolidate location and path rendering for exceptions.

commit 86ccf82
Merge: daa92e3 3f8726e
Author: jwilson <jwilson@squareup.com>
Date:   Thu Jun 2 09:20:06 2016 -0400

    Merge branch 'deyboy90-master'

    * deyboy90-master:
      Enhancing the json reader, adding corresponding test case for it

commit 3f8726e
Author: Archit Dey <deyboy90@gmail.com>
Date:   Mon May 23 00:47:02 2016 -0700

    Enhancing the json reader, adding corresponding test case for it

commit 2df6550
Author: jwilson <jwilson@squareup.com>
Date:   Thu Jun 2 00:18:03 2016 -0400

    Don't use ThreadLocals for @JsonAdapter factories and
getDelegateAdapter().

commit 943c674
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue May 31 10:14:24 2016 -0700

    Removed ThreadLocal for activeJsonAdapterClasses

commit 45511fd
Author: Inderjeet Singh <inder@peel.com>
Date:   Wed May 18 18:21:39 2016 -0700

    Added support for JsonSerializer/JsonDeserializer for JsonAdapter
annotation.
    JsonAdapter is cached per the type of the JsonAdapter class.
    Added a test to ensure JsonAdapter works on fields of parameterized
types
    Keep track of registered JsonAdapters and JsonAdapterFactorys in
ThreadLocal.

commit daa92e3
Merge: 854760e 86d88c3
Author: Jake Wharton <jakewharton@gmail.com>
Date:   Wed May 25 15:10:18 2016 -0400

    Merge pull request google#865 from juandiana/runtimetypeadapterfactory-
docs-fix

    Fix registerTypeAdapterFactory method usage

commit 86d88c3
Author: Juan Andrés Diana <juandiana@gmail.com>
Date:   Wed May 25 15:49:39 2016 -0300

    The method registerTypeAdapterFactory accepts a TypeAdapterFactory
instance only.

commit 854760e
Merge: 2360cfa d4a9eb4
Author: inder123 <inder123@gmail.com>
Date:   Tue May 24 13:58:21 2016 -0700

    Merge pull request google#864 from juandiana/runtimetypeadapterfactory-
docs-fix

    Minor documentation fix on RuntimeTypeAdapterFactory

commit d4a9eb4
Author: Juan Andrés Diana <juandiana@gmail.com>
Date:   Tue May 24 16:45:55 2016 -0300

    Docs fix for the RuntimeTypeAdapterFactory class.
    Instances of classes that implement RuntimeTypeAdapterFactory should
be registered using the registerTypeAdapterFactory method instead of
registerTypeAdapter.

commit 2360cfa
Merge: bb451ea 2928b3e
Author: inder123 <inder123@gmail.com>
Date:   Mon May 23 23:17:54 2016 -0700

    Merge pull request google#863 from nykolaslima/explicit-null-in-json

    handle explicit null values in JSON

commit 2928b3e
Author: Nykolas Lima <nykolas.lima@gmail.com>
Date:   Mon May 23 16:44:30 2016 -0300

    handle explicit null values in JSON

commit bb451ea
Merge: ecda358 3ff16c3
Author: Jesse Wilson <jesse@swank.ca>
Date:   Tue May 17 17:26:52 2016 -0400

    Merge pull request google#832 from google/831

    Ensuring that JsonAdapter annotation works correctly for primitive
fi…

commit 3ff16c3
Author: Inderjeet Singh <inder@peel.com>
Date:   Tue May 17 13:30:59 2016 -0700

    Don't use a runtime wrapper if a JsonAdapter annotation is present
on a field.

    This ensures that JsonAdapter annotation works correctly on a
primitive field.
    This is a potentially backward incompatible change.

commit ecda358
Merge: 0f80936 61f83d6
Author: Jesse Wilson <jesse@swank.ca>
Date:   Tue May 17 07:38:50 2016 -0400

    Merge pull request google#857 from google/jdk16_regression

    Replaced a JDK 1.7 specific method with its JDK 1.6 equivalent.

commit 61f83d6
Author: Inderjeet Singh <inder123@gmail.com>
Date:   Tue May 17 01:03:00 2016 -0700

    Replaced a JDK 1.7 specific method with its JDK 1.6 equivalent.

commit 0f80936
Merge: c101e31 c414b36
Author: Jake Wharton <jakewharton@gmail.com>
Date:   Thu May 12 08:57:34 2016 -0700

    Merge pull request google#853 from Baschdl/patch-1

    Corrected documentation, copy&paste error

commit c414b36
Author: Baschdl <sebastian@salzreute.de>
Date:   Thu May 12 14:47:03 2016 +0200

    Corrected documentation, copy&paste error

Revert "Squashed commit of the following:"

This reverts commit 134abac.
sebasjm pushed a commit to sebasjm/gson that referenced this pull request Mar 11, 2018
…dapter

Add support for JsonSerializer/JsonDeserializer in the JsonAdapter annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants