Skip to content
Permalink
Browse files

The JavaDoc is now more accurate about the type adapter serialization…

… and deserialization (#1441)
  • Loading branch information...
lyubomyr-shaydariv authored and inder123 committed Oct 28, 2019
1 parent 87b1d26 commit 47b28d99a17d492b37fcdd0fc41290419a010a0f
Showing with 12 additions and 0 deletions.
  1. +12 −0 extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java
@@ -120,6 +120,18 @@
* .registerSubtype(Circle.class)
* .registerSubtype(Diamond.class);
* }</pre>
*
* <h3>Serialization and deserialization</h3>
* In order to serialize and deserialize a polymorphic object,
* you must specify the base type explicitly.
* <pre> {@code
* Diamond diamond = new Diamond();
* String json = gson.toJson(diamond, Shape.class);
* }</pre>
* And then:
* <pre> {@code
* Shape shape = gson.fromJson(json, Shape.class);
* }</pre>
*/
public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
private final Class<?> baseType;

0 comments on commit 47b28d9

Please sign in to comment.
You can’t perform that action at this time.