Skip to content

Commit 2860908

Browse files
authored
Add Javadoc since tags for previously added elements (#2211)
1 parent 47668fa commit 2860908

File tree

10 files changed

+34
-10
lines changed

10 files changed

+34
-10
lines changed

gson/src/main/java/com/google/gson/FieldNamingPolicy.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
8686
* <li>aStringField ---&gt; A_STRING_FIELD</li>
8787
* <li>aURL ---&gt; A_U_R_L</li>
8888
* </ul>
89+
*
90+
* @since 2.9.0
8991
*/
9092
UPPER_CASE_WITH_UNDERSCORES() {
9193
@Override public String translateName(Field f) {
@@ -125,7 +127,8 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
125127
* Using dashes in JavaScript is not recommended since dash is also used for a minus sign in
126128
* expressions. This requires that a field named with dashes is always accessed as a quoted
127129
* property like {@code myobject['my-field']}. Accessing it as an object field
128-
* {@code myobject.my-field} will result in an unintended javascript expression.
130+
* {@code myobject.my-field} will result in an unintended JavaScript expression.
131+
*
129132
* @since 1.4
130133
*/
131134
LOWER_CASE_WITH_DASHES() {
@@ -148,8 +151,9 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
148151
* Using dots in JavaScript is not recommended since dot is also used for a member sign in
149152
* expressions. This requires that a field named with dots is always accessed as a quoted
150153
* property like {@code myobject['my.field']}. Accessing it as an object field
151-
* {@code myobject.my.field} will result in an unintended javascript expression.
152-
* @since 2.8
154+
* {@code myobject.my.field} will result in an unintended JavaScript expression.
155+
*
156+
* @since 2.8.4
153157
*/
154158
LOWER_CASE_WITH_DOTS() {
155159
@Override public String translateName(Field f) {

gson/src/main/java/com/google/gson/Gson.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ public Gson() {
343343
* instance.
344344
*
345345
* @return a GsonBuilder instance.
346+
* @since 2.8.3
346347
*/
347348
public GsonBuilder newBuilder() {
348349
return new GsonBuilder(this);

gson/src/main/java/com/google/gson/GsonBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrateg
364364
* @param objectToNumberStrategy the actual object-to-number strategy
365365
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
366366
* @see ToNumberPolicy#DOUBLE The default object-to-number strategy
367+
* @since 2.8.9
367368
*/
368369
public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy objectToNumberStrategy) {
369370
this.objectToNumberStrategy = Objects.requireNonNull(objectToNumberStrategy);
@@ -376,6 +377,7 @@ public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy objectToNumberStra
376377
* @param numberToNumberStrategy the actual number-to-number strategy
377378
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
378379
* @see ToNumberPolicy#LAZILY_PARSED_NUMBER The default number-to-number strategy
380+
* @since 2.8.9
379381
*/
380382
public GsonBuilder setNumberToNumberStrategy(ToNumberStrategy numberToNumberStrategy) {
381383
this.numberToNumberStrategy = Objects.requireNonNull(numberToNumberStrategy);
@@ -682,6 +684,7 @@ public GsonBuilder serializeSpecialFloatingPointValues() {
682684
* disabling usage of {@code Unsafe}.
683685
*
684686
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
687+
* @since 2.9.0
685688
*/
686689
public GsonBuilder disableJdkUnsafe() {
687690
this.useJdkUnsafe = false;
@@ -702,6 +705,7 @@ public GsonBuilder disableJdkUnsafe() {
702705
*
703706
* @param filter filter to add
704707
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
708+
* @since 2.9.1
705709
*/
706710
public GsonBuilder addReflectionAccessFilter(ReflectionAccessFilter filter) {
707711
Objects.requireNonNull(filter);

gson/src/main/java/com/google/gson/JsonArray.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public JsonArray() {
4848
* @param capacity initial capacity.
4949
* @throws IllegalArgumentException if the {@code capacity} is
5050
* negative
51+
* @since 2.8.1
5152
*/
5253
@SuppressWarnings("deprecation") // superclass constructor
5354
public JsonArray(int capacity) {
@@ -75,6 +76,7 @@ public JsonArray deepCopy() {
7576
* Adds the specified boolean to self.
7677
*
7778
* @param bool the boolean that needs to be added to the array.
79+
* @since 2.4
7880
*/
7981
public void add(Boolean bool) {
8082
elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool));
@@ -84,6 +86,7 @@ public void add(Boolean bool) {
8486
* Adds the specified character to self.
8587
*
8688
* @param character the character that needs to be added to the array.
89+
* @since 2.4
8790
*/
8891
public void add(Character character) {
8992
elements.add(character == null ? JsonNull.INSTANCE : new JsonPrimitive(character));
@@ -93,6 +96,7 @@ public void add(Character character) {
9396
* Adds the specified number to self.
9497
*
9598
* @param number the number that needs to be added to the array.
99+
* @since 2.4
96100
*/
97101
public void add(Number number) {
98102
elements.add(number == null ? JsonNull.INSTANCE : new JsonPrimitive(number));
@@ -102,6 +106,7 @@ public void add(Number number) {
102106
* Adds the specified string to self.
103107
*
104108
* @param string the string that needs to be added to the array.
109+
* @since 2.4
105110
*/
106111
public void add(String string) {
107112
elements.add(string == null ? JsonNull.INSTANCE : new JsonPrimitive(string));
@@ -190,6 +195,7 @@ public int size() {
190195
* Returns true if the array is empty.
191196
*
192197
* @return true if the array is empty.
198+
* @since 2.8.7
193199
*/
194200
public boolean isEmpty() {
195201
return elements.isEmpty();

gson/src/main/java/com/google/gson/JsonObject.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public Set<String> keySet() {
146146
* Returns the number of key/value pairs in the object.
147147
*
148148
* @return the number of key/value pairs in the object.
149+
* @since 2.7
149150
*/
150151
public int size() {
151152
return members.size();

gson/src/main/java/com/google/gson/JsonParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public JsonParser() {}
4545
* @param json JSON text
4646
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
4747
* @throws JsonParseException if the specified text is not valid JSON
48+
* @since 2.8.6
4849
*/
4950
public static JsonElement parseString(String json) throws JsonSyntaxException {
5051
return parseReader(new StringReader(json));
@@ -61,6 +62,7 @@ public static JsonElement parseString(String json) throws JsonSyntaxException {
6162
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
6263
* @throws JsonParseException if there is an IOException or if the specified
6364
* text is not valid JSON
65+
* @since 2.8.6
6466
*/
6567
public static JsonElement parseReader(Reader reader) throws JsonIOException, JsonSyntaxException {
6668
try {
@@ -90,6 +92,7 @@ public static JsonElement parseReader(Reader reader) throws JsonIOException, Jso
9092
*
9193
* @throws JsonParseException if there is an IOException or if the specified
9294
* text is not valid JSON
95+
* @since 2.8.6
9396
*/
9497
public static JsonElement parseReader(JsonReader reader)
9598
throws JsonIOException, JsonSyntaxException {

gson/src/main/java/com/google/gson/ReflectionAccessFilter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.google.gson;
22

3-
import java.lang.reflect.AccessibleObject;
4-
53
import com.google.gson.internal.ReflectionAccessFilterHelper;
4+
import java.lang.reflect.AccessibleObject;
65

76
/**
87
* Filter for determining whether reflection based serialization and
@@ -28,10 +27,13 @@
2827
* fields and classes.
2928
*
3029
* @see GsonBuilder#addReflectionAccessFilter(ReflectionAccessFilter)
30+
* @since 2.9.1
3131
*/
3232
public interface ReflectionAccessFilter {
3333
/**
3434
* Result of a filter check.
35+
*
36+
* @since 2.9.1
3537
*/
3638
enum FilterResult {
3739
/**

gson/src/main/java/com/google/gson/ToNumberPolicy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
package com.google.gson;
1818

19-
import java.io.IOException;
20-
import java.math.BigDecimal;
21-
2219
import com.google.gson.internal.LazilyParsedNumber;
2320
import com.google.gson.stream.JsonReader;
2421
import com.google.gson.stream.MalformedJsonException;
22+
import java.io.IOException;
23+
import java.math.BigDecimal;
2524

2625
/**
2726
* An enumeration that defines two standard number reading strategies and a couple of
2827
* strategies to overcome some historical Gson limitations while deserializing numbers as
2928
* {@link Object} and {@link Number}.
3029
*
3130
* @see ToNumberStrategy
31+
* @since 2.8.9
3232
*/
3333
public enum ToNumberPolicy implements ToNumberStrategy {
3434

gson/src/main/java/com/google/gson/ToNumberStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
package com.google.gson;
1818

19-
import java.io.IOException;
20-
2119
import com.google.gson.stream.JsonReader;
20+
import java.io.IOException;
2221

2322
/**
2423
* A strategy that is used to control how numbers should be deserialized for {@link Object} and {@link Number}
@@ -56,6 +55,7 @@
5655
* @see ToNumberPolicy
5756
* @see GsonBuilder#setObjectToNumberStrategy(ToNumberStrategy)
5857
* @see GsonBuilder#setNumberToNumberStrategy(ToNumberStrategy)
58+
* @since 2.8.9
5959
*/
6060
public interface ToNumberStrategy {
6161

gson/src/main/java/com/google/gson/stream/JsonWriter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ public JsonWriter value(String value) throws IOException {
429429
* @return this writer.
430430
* @throws UnsupportedOperationException if this writer does not support
431431
* writing raw JSON values.
432+
* @since 2.4
432433
*/
433434
public JsonWriter jsonValue(String value) throws IOException {
434435
if (value == null) {
@@ -475,6 +476,7 @@ public JsonWriter value(boolean value) throws IOException {
475476
* Encodes {@code value}.
476477
*
477478
* @return this writer.
479+
* @since 2.7
478480
*/
479481
public JsonWriter value(Boolean value) throws IOException {
480482
if (value == null) {
@@ -495,6 +497,7 @@ public JsonWriter value(Boolean value) throws IOException {
495497
* @return this writer.
496498
* @throws IllegalArgumentException if the value is NaN or Infinity and this writer is not {@link
497499
* #setLenient(boolean) lenient}.
500+
* @since 2.9.1
498501
*/
499502
public JsonWriter value(float value) throws IOException {
500503
writeDeferredName();

0 commit comments

Comments
 (0)