diff --git a/gson/src/main/java/com/google/gson/TypeAdapter.java b/gson/src/main/java/com/google/gson/TypeAdapter.java index 947106f8..f2ad9923 100644 --- a/gson/src/main/java/com/google/gson/TypeAdapter.java +++ b/gson/src/main/java/com/google/gson/TypeAdapter.java @@ -30,14 +30,13 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; /** - * Converts between Java objects and JSON. Applications use type adapters both - * for customizing types' JSON forms, and for JSON conversions. + * Converts Java objects to and from JSON. * *
{@code + * adapters. If Gson's default JSON conversion isn't appropriate for a type, + * extend this class to customize the conversion. Here's an example of a type + * adapter for an (X,Y) coordinate point:{@code * * public class PointAdapter extends TypeAdapter{ * public Point read(JsonReader reader) throws IOException { @@ -67,13 +66,14 @@ import com.google.gson.stream.JsonWriter; * The {@link #read(JsonReader) read()} method must read exactly one value * and {@link #write(JsonWriter,Object) write()} must write exactly one value. * For primitive types this is means readers should make exactly one call to - *
nextType()
and writers should make exactly one call to - * one ofvalue()
ornullValue()
. For composite types, - * type adapters should start with a call tobeginType()
, - * convert the entire contents of the object or array, and finish with a call - * toendType()
. Failing to convert a value or converting - * too many values will disrupt the cadence of the caller and may cause the - * application to crash. + * {@code nextBoolean()}, {@code nextDouble()}, {@code nextInt()}, {@code + * nextLong()}, {@code nextString()} or {@code nextNull()}. Writers should make + * exactly one call to one ofvalue()
ornullValue()
. + * For arrays, type adapters should start with a call to {@code beginArray()}, + * convert all elements, and finish with a call to {@code endArray}. For + * objects, they should start with {@code beginObject()}, convert the object, + * and finish with {@code endObject()}. Failing to convert a value or converting + * too many values may cause the application to crash. * *Type adapters should be prepared to read null from the stream and write it * to the stream. If your {@code Gson} instance has been configured to {@link