Skip to content

Commit

Permalink
Add more Javadoc cross-links between methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed May 20, 2024
1 parent 4f12c00 commit 2ac141b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gson/src/main/java/com/google/gson/FormattingStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -98,10 +99,11 @@ public FormattingStyle withNewline(String newline) {
/**
* Creates a {@link FormattingStyle} with the specified indent string.
*
* <p>Only combinations of spaces and tabs allowed in indent.
* <p>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);
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions gson/src/main/java/com/google/gson/Strictness.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions gson/src/main/java/com/google/gson/stream/JsonWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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() {
Expand Down Expand Up @@ -360,13 +362,17 @@ 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;
}

/**
* 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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2ac141b

Please sign in to comment.