jclouds/jclouds — pull request #594 by adriancole (2014-10-30 04:10:50+00:00)
Title: Support serializing auto-value types without custom type adapters

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!