Fix Javadoc warnings and errors (#2040)
This commit is contained in:
parent
6dfbdc861f
commit
6ffcdf3029
@ -28,8 +28,8 @@ import java.lang.annotation.Target;
|
|||||||
* after it has been deserialized from Json.
|
* after it has been deserialized from Json.
|
||||||
* Here is an example of how this annotation is used:
|
* Here is an example of how this annotation is used:
|
||||||
* <p>Here is an example of how this annotation is used:
|
* <p>Here is an example of how this annotation is used:
|
||||||
* <p><pre>
|
* <pre>
|
||||||
* @Intercept(postDeserialize=UserValidator.class)
|
* @Intercept(postDeserialize=UserValidator.class)
|
||||||
* public class User {
|
* public class User {
|
||||||
* String name;
|
* String name;
|
||||||
* String password;
|
* String password;
|
||||||
@ -47,7 +47,7 @@ import java.lang.annotation.Target;
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
|
@ -76,7 +76,7 @@ import com.google.gson.stream.MalformedJsonException;
|
|||||||
* MyType target = new MyType();
|
* MyType target = new MyType();
|
||||||
* String json = gson.toJson(target); // serializes target to Json
|
* String json = gson.toJson(target); // serializes target to Json
|
||||||
* MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2
|
* MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>If the object that your are serializing/deserializing is a {@code ParameterizedType}
|
* <p>If the object that your are serializing/deserializing is a {@code ParameterizedType}
|
||||||
* (i.e. contains at least one type parameter and may be an array) then you must use the
|
* (i.e. contains at least one type parameter and may be an array) then you must use the
|
||||||
@ -91,7 +91,7 @@ import com.google.gson.stream.MalformedJsonException;
|
|||||||
* Gson gson = new Gson();
|
* Gson gson = new Gson();
|
||||||
* String json = gson.toJson(target, listType);
|
* String json = gson.toJson(target, listType);
|
||||||
* List<String> target2 = gson.fromJson(json, listType);
|
* List<String> target2 = gson.fromJson(json, listType);
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>See the <a href="https://sites.google.com/site/gson/gson-user-guide">Gson User Guide</a>
|
* <p>See the <a href="https://sites.google.com/site/gson/gson-user-guide">Gson User Guide</a>
|
||||||
* for a more complete set of examples.</p>
|
* for a more complete set of examples.</p>
|
||||||
@ -548,7 +548,7 @@ public final class Gson {
|
|||||||
* read or written.
|
* read or written.
|
||||||
* @param skipPast The type adapter factory that needs to be skipped while searching for
|
* @param skipPast The type adapter factory that needs to be skipped while searching for
|
||||||
* a matching type adapter. In most cases, you should just pass <i>this</i> (the type adapter
|
* a matching type adapter. In most cases, you should just pass <i>this</i> (the type adapter
|
||||||
* factory from where {@link #getDelegateAdapter} method is being invoked).
|
* factory from where {@code getDelegateAdapter} method is being invoked).
|
||||||
* @param type Type for which the delegate adapter is being searched for.
|
* @param type Type for which the delegate adapter is being searched for.
|
||||||
*
|
*
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
|
@ -61,7 +61,7 @@ import static com.google.gson.Gson.DEFAULT_SPECIALIZE_FLOAT_VALUES;
|
|||||||
* .setPrettyPrinting()
|
* .setPrettyPrinting()
|
||||||
* .setVersion(1.0)
|
* .setVersion(1.0)
|
||||||
* .create();
|
* .create();
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>NOTES:
|
* <p>NOTES:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -70,7 +70,6 @@ import static com.google.gson.Gson.DEFAULT_SPECIALIZE_FLOAT_VALUES;
|
|||||||
* not contain time-zone information. So, if you are using date/time instances,
|
* not contain time-zone information. So, if you are using date/time instances,
|
||||||
* use {@code GsonBuilder} and its {@code setDateFormat} methods.</li>
|
* use {@code GsonBuilder} and its {@code setDateFormat} methods.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
* @author Joel Leitch
|
* @author Joel Leitch
|
||||||
@ -251,6 +250,7 @@ public final class GsonBuilder {
|
|||||||
* original.put(new Point(8, 8), "b");
|
* original.put(new Point(8, 8), "b");
|
||||||
* System.out.println(gson.toJson(original, type));
|
* System.out.println(gson.toJson(original, type));
|
||||||
* }
|
* }
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* The JSON output would look as follows:
|
* The JSON output would look as follows:
|
||||||
* <pre> {@code
|
* <pre> {@code
|
||||||
|
@ -26,7 +26,7 @@ import java.lang.reflect.Type;
|
|||||||
* <p>Let us look at example where defining a serializer will be useful. The {@code Id} class
|
* <p>Let us look at example where defining a serializer will be useful. The {@code Id} class
|
||||||
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
||||||
*
|
*
|
||||||
* <p><pre>
|
* <pre>
|
||||||
* public class Id<T> {
|
* public class Id<T> {
|
||||||
* private final Class<T> clazz;
|
* private final Class<T> clazz;
|
||||||
* private final long value;
|
* private final long value;
|
||||||
@ -40,20 +40,20 @@ import java.lang.reflect.Type;
|
|||||||
* return value;
|
* return value;
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>The default serialization of {@code Id(com.foo.MyObject.class, 20L)} will be
|
* <p>The default serialization of {@code Id(com.foo.MyObject.class, 20L)} will be
|
||||||
* <code>{"clazz":com.foo.MyObject,"value":20}</code>. Suppose, you just want the output to be
|
* <code>{"clazz":com.foo.MyObject,"value":20}</code>. Suppose, you just want the output to be
|
||||||
* the value instead, which is {@code 20} in this case. You can achieve that by writing a custom
|
* the value instead, which is {@code 20} in this case. You can achieve that by writing a custom
|
||||||
* serializer:</p>
|
* serializer:</p>
|
||||||
*
|
*
|
||||||
* <p><pre>
|
* <pre>
|
||||||
* class IdSerializer implements JsonSerializer<Id>() {
|
* class IdSerializer implements JsonSerializer<Id>() {
|
||||||
* public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
|
* public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
|
||||||
* return new JsonPrimitive(id.getValue());
|
* return new JsonPrimitive(id.getValue());
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre></p>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>You will also need to register {@code IdSerializer} with Gson as follows:</p>
|
* <p>You will also need to register {@code IdSerializer} with Gson as follows:</p>
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -65,7 +65,6 @@ public interface ToNumberStrategy {
|
|||||||
*
|
*
|
||||||
* @param in JSON reader to read a number from
|
* @param in JSON reader to read a number from
|
||||||
* @return number read from the JSON reader.
|
* @return number read from the JSON reader.
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public Number readNumber(JsonReader in) throws IOException;
|
public Number readNumber(JsonReader in) throws IOException;
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,14 @@ import java.lang.annotation.Target;
|
|||||||
* method.</p>
|
* method.</p>
|
||||||
*
|
*
|
||||||
* <p>Here is an example of how this annotation is meant to be used:
|
* <p>Here is an example of how this annotation is meant to be used:
|
||||||
* <p><pre>
|
* <pre>
|
||||||
* public class User {
|
* public class User {
|
||||||
* @Expose private String firstName;
|
* @Expose private String firstName;
|
||||||
* @Expose(serialize = false) private String lastName;
|
* @Expose(serialize = false) private String lastName;
|
||||||
* @Expose (serialize = false, deserialize = false) private String emailAddress;
|
* @Expose (serialize = false, deserialize = false) private String emailAddress;
|
||||||
* private String password;
|
* private String password;
|
||||||
* }
|
* }
|
||||||
* </pre></p>
|
* </pre>
|
||||||
* If you created Gson with {@code new Gson()}, the {@code toJson()} and {@code fromJson()}
|
* If you created Gson with {@code new Gson()}, the {@code toJson()} and {@code fromJson()}
|
||||||
* methods will use the {@code password} field along-with {@code firstName}, {@code lastName},
|
* methods will use the {@code password} field along-with {@code firstName}, {@code lastName},
|
||||||
* and {@code emailAddress} for serialization and deserialization. However, if you created Gson
|
* and {@code emailAddress} for serialization and deserialization. However, if you created Gson
|
||||||
|
@ -170,7 +170,7 @@ import java.util.Arrays;
|
|||||||
* precision loss, extremely large values should be written and read as strings
|
* precision loss, extremely large values should be written and read as strings
|
||||||
* in JSON.
|
* in JSON.
|
||||||
*
|
*
|
||||||
* <a id="nonexecuteprefix"/><h3>Non-Execute Prefix</h3>
|
* <h3 id="nonexecuteprefix">Non-Execute Prefix</h3>
|
||||||
* Web servers that serve private data using JSON may be vulnerable to <a
|
* Web servers that serve private data using JSON may be vulnerable to <a
|
||||||
* href="http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery">Cross-site
|
* href="http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery">Cross-site
|
||||||
* request forgery</a> attacks. In such an attack, a malicious site gains access
|
* request forgery</a> attacks. In such an attack, a malicious site gains access
|
||||||
|
@ -37,7 +37,6 @@ import com.google.protobuf.Descriptors.FieldDescriptor;
|
|||||||
import com.google.protobuf.DynamicMessage;
|
import com.google.protobuf.DynamicMessage;
|
||||||
import com.google.protobuf.Extension;
|
import com.google.protobuf.Extension;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -76,7 +75,7 @@ public class ProtoTypeAdapter
|
|||||||
/**
|
/**
|
||||||
* Determines how enum <u>values</u> should be serialized.
|
* Determines how enum <u>values</u> should be serialized.
|
||||||
*/
|
*/
|
||||||
public static enum EnumSerialization {
|
public enum EnumSerialization {
|
||||||
/**
|
/**
|
||||||
* Serializes and deserializes enum values using their <b>number</b>. When this is used, custom
|
* Serializes and deserializes enum values using their <b>number</b>. When this is used, custom
|
||||||
* value names set on enums are ignored.
|
* value names set on enums are ignored.
|
||||||
@ -117,12 +116,12 @@ public class ProtoTypeAdapter
|
|||||||
* For example, if you use the following parameters: {@link CaseFormat#LOWER_UNDERSCORE},
|
* For example, if you use the following parameters: {@link CaseFormat#LOWER_UNDERSCORE},
|
||||||
* {@link CaseFormat#LOWER_CAMEL}, the following conversion will occur:
|
* {@link CaseFormat#LOWER_CAMEL}, the following conversion will occur:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>{@code
|
||||||
* PROTO <-> JSON
|
* PROTO <-> JSON
|
||||||
* my_field myField
|
* my_field myField
|
||||||
* foo foo
|
* foo foo
|
||||||
* n__id_ct nIdCt
|
* n__id_ct nIdCt
|
||||||
* </pre>
|
* }</pre>
|
||||||
*/
|
*/
|
||||||
public Builder setFieldNameSerializationFormat(CaseFormat fromFieldNameFormat,
|
public Builder setFieldNameSerializationFormat(CaseFormat fromFieldNameFormat,
|
||||||
CaseFormat toFieldNameFormat) {
|
CaseFormat toFieldNameFormat) {
|
||||||
|
Loading…
Reference in New Issue
Block a user