Skip to content

Commit

Permalink
Fix TEXT-234 (#547)
Browse files Browse the repository at this point in the history
continued to implement changes to Javadoc as mentioned in: #546
  • Loading branch information
TobiasKiecker authored May 25, 2024
1 parent cb6a74f commit 3b20214
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/org/apache/commons/text/TextStringBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ public static TextStringBuilder wrap(final char[] initialBuffer, final int lengt
/** Internal data storage. */
private char[] buffer;

/** The new line. */
/**
* The new line, {@code null} means use the system default from {@link System#lineSeparator()}.
*/
private String newLine;

/** The null text. */
Expand Down Expand Up @@ -1162,13 +1164,18 @@ public TextStringBuilder appendln(final TextStringBuilder str, final int startIn
}

/**
* Appends the new line string to this string builder.
* Appends this builder's new line string to this builder.
* <p>
* By default, the new line is the system default from {@link System#lineSeparator()}.
* </p>
* <p>
* The new line string can be altered using {@link #setNewLineText(String)}. This might be used to force the output
* to always use UNIX line endings even when on Windows.
* The new line string can be changed using {@link #setNewLineText(String)}. For example, you can use this to force the output to always use UNIX line
* endings even when on Windows.
* </p>
*
* @return this, to enable chaining
* @return this
* @see #getNewLineText()
* @see #setNewLineText(String)
*/
public TextStringBuilder appendNewLine() {
if (newLine == null) {
Expand Down Expand Up @@ -2021,9 +2028,9 @@ public void getChars(final int startIndex, final int endIndex, final char[] targ
}

/**
* Gets the text to be appended when a new line is added.
* Gets the text to be appended when a {@link #appendNewLine() new line} is added.
*
* @return The new line text, null means use system default
* @return The new line text, {@code null} means use the system default from {@link System#lineSeparator()}.
*/
public String getNewLineText() {
return newLine;
Expand Down Expand Up @@ -3014,10 +3021,10 @@ public TextStringBuilder setLength(final int length) {
}

/**
* Sets the text to be appended when a new line is added.
* Sets the text to be appended when {@link #appendNewLine() new line} is called.
*
* @param newLine the new line text, null means use system default
* @return this, to enable chaining
* @param newLine the new line text, {@code null} means use the system default from {@link System#lineSeparator()}.
* @return this.
*/
public TextStringBuilder setNewLineText(final String newLine) {
this.newLine = newLine;
Expand Down

0 comments on commit 3b20214

Please sign in to comment.