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.
|
||||
* Here is an example of how this annotation is used:
|
||||
* <p>Here is an example of how this annotation is used:
|
||||
* <p><pre>
|
||||
* @Intercept(postDeserialize=UserValidator.class)
|
||||
* <pre>
|
||||
* @Intercept(postDeserialize=UserValidator.class)
|
||||
* public class User {
|
||||
* String name;
|
||||
* String password;
|
||||
|
@ -47,7 +47,7 @@ import java.lang.annotation.Target;
|
|||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
|
|
|
@ -76,7 +76,7 @@ import com.google.gson.stream.MalformedJsonException;
|
|||
* MyType target = new MyType();
|
||||
* String json = gson.toJson(target); // serializes target to Json
|
||||
* 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}
|
||||
* (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();
|
||||
* String json = gson.toJson(target, 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>
|
||||
* for a more complete set of examples.</p>
|
||||
|
@ -548,7 +548,7 @@ public final class Gson {
|
|||
* read or written.
|
||||
* @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
|
||||
* 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.
|
||||
*
|
||||
* @since 2.2
|
||||
|
|
|
@ -61,7 +61,7 @@ import static com.google.gson.Gson.DEFAULT_SPECIALIZE_FLOAT_VALUES;
|
|||
* .setPrettyPrinting()
|
||||
* .setVersion(1.0)
|
||||
* .create();
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* <p>NOTES:
|
||||
* <ul>
|
||||
|
@ -69,8 +69,7 @@ import static com.google.gson.Gson.DEFAULT_SPECIALIZE_FLOAT_VALUES;
|
|||
* <li> The default serialization of {@link Date} and its subclasses in Gson does
|
||||
* not contain time-zone information. So, if you are using date/time instances,
|
||||
* use {@code GsonBuilder} and its {@code setDateFormat} methods.</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
* </ul>
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
|
@ -251,6 +250,7 @@ public final class GsonBuilder {
|
|||
* original.put(new Point(8, 8), "b");
|
||||
* System.out.println(gson.toJson(original, type));
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* The JSON output would look as follows:
|
||||
* <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
|
||||
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
||||
*
|
||||
* <p><pre>
|
||||
* <pre>
|
||||
* public class Id<T> {
|
||||
* private final Class<T> clazz;
|
||||
* private final long value;
|
||||
|
@ -40,20 +40,20 @@ import java.lang.reflect.Type;
|
|||
* return value;
|
||||
* }
|
||||
* }
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* <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
|
||||
* the value instead, which is {@code 20} in this case. You can achieve that by writing a custom
|
||||
* serializer:</p>
|
||||
*
|
||||
* <p><pre>
|
||||
* <pre>
|
||||
* class IdSerializer implements JsonSerializer<Id>() {
|
||||
* public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
|
||||
* return new JsonPrimitive(id.getValue());
|
||||
* }
|
||||
* }
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* <p>You will also need to register {@code IdSerializer} with Gson as follows:</p>
|
||||
* <pre>
|
||||
|
|
|
@ -65,7 +65,6 @@ public interface ToNumberStrategy {
|
|||
*
|
||||
* @param in JSON reader to read a number from
|
||||
* @return number read from the JSON reader.
|
||||
* @throws IOException
|
||||
*/
|
||||
public Number readNumber(JsonReader in) throws IOException;
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@ import java.lang.annotation.Target;
|
|||
* method.</p>
|
||||
*
|
||||
* <p>Here is an example of how this annotation is meant to be used:
|
||||
* <p><pre>
|
||||
* <pre>
|
||||
* public class User {
|
||||
* @Expose private String firstName;
|
||||
* @Expose(serialize = false) private String lastName;
|
||||
* @Expose (serialize = false, deserialize = false) private String emailAddress;
|
||||
* private String password;
|
||||
* }
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
* 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},
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
|
|
|
@ -37,7 +37,6 @@ import com.google.protobuf.Descriptors.FieldDescriptor;
|
|||
import com.google.protobuf.DynamicMessage;
|
||||
import com.google.protobuf.Extension;
|
||||
import com.google.protobuf.Message;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -76,7 +75,7 @@ public class ProtoTypeAdapter
|
|||
/**
|
||||
* 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
|
||||
* 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},
|
||||
* {@link CaseFormat#LOWER_CAMEL}, the following conversion will occur:
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* PROTO <-> JSON
|
||||
* my_field myField
|
||||
* foo foo
|
||||
* n__id_ct nIdCt
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*/
|
||||
public Builder setFieldNameSerializationFormat(CaseFormat fromFieldNameFormat,
|
||||
CaseFormat toFieldNameFormat) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user