You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Adrian Cole <no...@github.com> on 2014/10/30 05:10:52 UTC

[jclouds] Support serializing auto-value types without custom type adapters (#594)

AutoValue types are abstract classes, a documented tough spot in gson serialization. Usually, the answer is registering a type hierarchy adapter for each type. This is unsustainable with value types as they are often small and nested.

Luckily, auto-value is a constrained domain. They are abstract classes with a builder method, and we tag that method with `@SerializedName`. These types can never validly have multiple subclasses, nor be parameterized, etc. Moreover, they have a very specific naming convention.

Long story short, rather than try to make gson support any given abstract type, handling auto-value is kindof easy and not fragile either. The approach in this PR works!
You can merge this Pull Request by running:

  git pull https://github.com/adriancole/jclouds adrian.auto-serialization

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/594

-- Commit Summary --

  * JCLOUDS-750 support serializing auto-value types without custom type adapters.

-- File Changes --

    M core/pom.xml (5)
    M core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java (18)
    M core/src/test/java/org/jclouds/json/JsonTest.java (54)
    M project/pom.xml (6)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/594.patch
https://github.com/jclouds/jclouds/pull/594.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1365](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1365/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61049600

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1887](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1887/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61051326

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by Adrian Cole <no...@github.com>.
cherry-picked into master, 1.8.x

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61101750

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #275](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/275/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61044545

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by Adrian Cole <no...@github.com>.
Note: this pull request fixes https://github.com/jclouds/jclouds-labs-google/pull/68

@jdaggett @nacx PTAL

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61048960

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1364](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1364/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61044849

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #277](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/277/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61050238

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1886](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1886/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61046275

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by Ignasi Barrera <no...@github.com>.
Neat! +1

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61060215

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #276](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/276/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61049324

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by Adrian Cole <no...@github.com>.
Closed #594.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#event-185962174

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1366](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1366/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61050415

Re: [jclouds] Support serializing auto-value types without custom type adapters (#594)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1888](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1888/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/594#issuecomment-61055289