From 2ac141b7d4c1aaf1e394f378674191b711d53d18 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Tue, 21 May 2024 00:13:43 +0200 Subject: [PATCH] Add more Javadoc cross-links between methods --- .../main/java/com/google/gson/FormattingStyle.java | 13 +++++++++++-- gson/src/main/java/com/google/gson/Strictness.java | 1 + .../java/com/google/gson/stream/JsonWriter.java | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gson/src/main/java/com/google/gson/FormattingStyle.java b/gson/src/main/java/com/google/gson/FormattingStyle.java index 7d092afa15..8b0ba17332 100644 --- a/gson/src/main/java/com/google/gson/FormattingStyle.java +++ b/gson/src/main/java/com/google/gson/FormattingStyle.java @@ -90,6 +90,7 @@ private FormattingStyle(String newline, String indent, boolean spaceAfterSeparat * * @param newline the string value that will be used as newline. * @return a newly created {@link FormattingStyle} + * @see #getNewline() */ public FormattingStyle withNewline(String newline) { return new FormattingStyle(newline, this.indent, this.spaceAfterSeparators); @@ -98,10 +99,11 @@ public FormattingStyle withNewline(String newline) { /** * Creates a {@link FormattingStyle} with the specified indent string. * - *

Only combinations of spaces and tabs allowed in indent. + *

Only combinations of spaces and tabs are allowed in indent. * * @param indent the string value that will be used as indent. * @return a newly created {@link FormattingStyle} + * @see #getIndent() */ public FormattingStyle withIndent(String indent) { return new FormattingStyle(this.newline, indent, this.spaceAfterSeparators); @@ -117,6 +119,7 @@ public FormattingStyle withIndent(String indent) { * * @param spaceAfterSeparators whether to output a space after {@code ','} and {@code ':'}. * @return a newly created {@link FormattingStyle} + * @see #usesSpaceAfterSeparators() */ public FormattingStyle withSpaceAfterSeparators(boolean spaceAfterSeparators) { return new FormattingStyle(this.newline, this.indent, spaceAfterSeparators); @@ -126,6 +129,7 @@ public FormattingStyle withSpaceAfterSeparators(boolean spaceAfterSeparators) { * Returns the string value that will be used as a newline. * * @return the newline value. + * @see #withNewline(String) */ public String getNewline() { return this.newline; @@ -135,12 +139,17 @@ public String getNewline() { * Returns the string value that will be used as indent. * * @return the indent value. + * @see #withIndent(String) */ public String getIndent() { return this.indent; } - /** Returns whether a space will be used after {@code ','} and {@code ':'}. */ + /** + * Returns whether a space will be used after {@code ','} and {@code ':'}. + * + * @see #withSpaceAfterSeparators(boolean) + */ public boolean usesSpaceAfterSeparators() { return this.spaceAfterSeparators; } diff --git a/gson/src/main/java/com/google/gson/Strictness.java b/gson/src/main/java/com/google/gson/Strictness.java index b207cf508c..461f1c8d00 100644 --- a/gson/src/main/java/com/google/gson/Strictness.java +++ b/gson/src/main/java/com/google/gson/Strictness.java @@ -12,6 +12,7 @@ * the {@link JsonReader} and you can look at {@link JsonWriter#setStrictness(Strictness)} to see * how the strictness affects the {@link JsonWriter}. * + * @see GsonBuilder#setStrictness(Strictness) * @see JsonReader#setStrictness(Strictness) * @see JsonWriter#setStrictness(Strictness) * @since 2.11.0 diff --git a/gson/src/main/java/com/google/gson/stream/JsonWriter.java b/gson/src/main/java/com/google/gson/stream/JsonWriter.java index 7b67537579..8bf3d8123f 100644 --- a/gson/src/main/java/com/google/gson/stream/JsonWriter.java +++ b/gson/src/main/java/com/google/gson/stream/JsonWriter.java @@ -261,6 +261,7 @@ public final void setIndent(String indent) { * level of indentation, or the newline style, to accommodate various OS styles. * * @param formattingStyle the formatting style to use, must not be {@code null}. + * @see #getFormattingStyle() * @since 2.11.0 */ public final void setFormattingStyle(FormattingStyle formattingStyle) { @@ -286,6 +287,7 @@ public final void setFormattingStyle(FormattingStyle formattingStyle) { * Returns the pretty printing style used by this writer. * * @return the {@code FormattingStyle} that will be used. + * @see #setFormattingStyle(FormattingStyle) * @since 2.11.0 */ public final FormattingStyle getFormattingStyle() { @@ -360,6 +362,8 @@ public final Strictness getStrictness() { * This escapes the HTML characters {@code <}, {@code >}, {@code &}, {@code =} and {@code '} * before writing them to the stream. Without this setting, your XML/HTML encoder should replace * these characters with the corresponding escape sequences. + * + * @see #isHtmlSafe() */ public final void setHtmlSafe(boolean htmlSafe) { this.htmlSafe = htmlSafe; @@ -367,6 +371,8 @@ public final void setHtmlSafe(boolean htmlSafe) { /** * Returns true if this writer writes JSON that's safe for inclusion in HTML and XML documents. + * + * @see #setHtmlSafe(boolean) */ public final boolean isHtmlSafe() { return htmlSafe; @@ -375,6 +381,8 @@ public final boolean isHtmlSafe() { /** * Sets whether object members are serialized when their value is null. This has no impact on * array elements. The default is true. + * + * @see #getSerializeNulls() */ public final void setSerializeNulls(boolean serializeNulls) { this.serializeNulls = serializeNulls; @@ -383,6 +391,8 @@ public final void setSerializeNulls(boolean serializeNulls) { /** * Returns true if object members are serialized when their value is null. This has no impact on * array elements. The default is true. + * + * @see #setSerializeNulls(boolean) */ public final boolean getSerializeNulls() { return serializeNulls;