Update JsonAdapter documentation (#976)

Include mention of JsonDeserializer and JsonSerializer.
This commit is contained in:
Kevin Most 2016-12-12 01:37:55 -05:00 committed by inder123
parent 44cad04a63
commit 5f73666404

View File

@ -16,6 +16,8 @@
package com.google.gson.annotations; package com.google.gson.annotations;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory; import com.google.gson.TypeAdapterFactory;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
@ -77,8 +79,10 @@ import java.lang.annotation.Target;
* adapters, which in turn take precedence over annotated types. * adapters, which in turn take precedence over annotated types.
* *
* <p>The class referenced by this annotation must be either a {@link * <p>The class referenced by this annotation must be either a {@link
* TypeAdapter} or a {@link TypeAdapterFactory}. Using the factory interface * TypeAdapter} or a {@link TypeAdapterFactory}, or must implement one
* makes it possible to delegate to the enclosing {@code Gson} instance. * or both of {@link JsonDeserializer} or {@link JsonSerializer}.
* Using {@link TypeAdapterFactory} makes it possible to delegate
* to the enclosing {@code Gson} instance.
* *
* @since 2.3 * @since 2.3
* *
@ -91,7 +95,7 @@ import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.FIELD}) @Target({ElementType.TYPE, ElementType.FIELD})
public @interface JsonAdapter { public @interface JsonAdapter {
/** Either a {@link TypeAdapter} or {@link TypeAdapterFactory}. */ /** Either a {@link TypeAdapter} or {@link TypeAdapterFactory}, or one or both of {@link JsonDeserializer} or {@link JsonSerializer}. */
Class<?> value(); Class<?> value();
/** false, to be able to handle {@code null} values within the adapter, default value is true. */ /** false, to be able to handle {@code null} values within the adapter, default value is true. */