Skip to content

Commit bbbc111

Browse files
committed
Javadoc
1 parent 63be79d commit bbbc111

11 files changed

+92
-92
lines changed

src/main/java/org/apache/commons/text/translate/AggregateTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class AggregateTranslator extends CharSequenceTranslator {
3939
/**
4040
* Specify the translators to be used at creation time.
4141
*
42-
* @param translators CharSequenceTranslator array to aggregate
42+
* @param translators CharSequenceTranslator array to aggregate.
4343
*/
4444
public AggregateTranslator(final CharSequenceTranslator... translators) {
4545
if (translators != null) {

src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public CharSequenceTranslator() {
5858

5959
/**
6060
* Helper for non-Writer usage.
61-
* @param input CharSequence to be translated
62-
* @return String output of translation
61+
*
62+
* @param input CharSequence to be translated.
63+
* @return String output of translation.
6364
*/
6465
public final String translate(final CharSequence input) {
6566
if (input == null) {
@@ -81,21 +82,21 @@ public final String translate(final CharSequence input) {
8182
* and the only IOExceptions thrown must be from interacting with the Writer so that
8283
* the top level API may reliably ignore StringWriter IOExceptions.
8384
*
84-
* @param input CharSequence that is being translated
85-
* @param index int representing the current point of translation
86-
* @param writer Writer to translate the text to
87-
* @return int count of code points consumed
88-
* @throws IOException if and only if the Writer produces an IOException
85+
* @param input CharSequence that is being translated.
86+
* @param index int representing the current point of translation.
87+
* @param writer Writer to translate the text to.
88+
* @return int count of code points consumed.
89+
* @throws IOException if and only if the Writer produces an IOException.
8990
*/
9091
public abstract int translate(CharSequence input, int index, Writer writer) throws IOException;
9192

9293
/**
9394
* Translate an input onto a Writer. This is intentionally final as its algorithm is
9495
* tightly coupled with the abstract method of this class.
9596
*
96-
* @param input CharSequence that is being translated
97-
* @param writer Writer to translate the text to
98-
* @throws IOException if and only if the Writer produces an IOException
97+
* @param input CharSequence that is being translated.
98+
* @param writer Writer to translate the text to.
99+
* @throws IOException if and only if the Writer produces an IOException.
99100
*/
100101
public final void translate(final CharSequence input, final Writer writer) throws IOException {
101102
Validate.isTrue(writer != null, "The Writer must not be null");
@@ -133,8 +134,8 @@ public final void translate(final CharSequence input, final Writer writer) throw
133134
* Helper method to create a merger of this translator with another set of
134135
* translators. Useful in customizing the standard functionality.
135136
*
136-
* @param translators CharSequenceTranslator array of translators to merge with this one
137-
* @return CharSequenceTranslator merging this translator with the others
137+
* @param translators CharSequenceTranslator array of translators to merge with this one.
138+
* @return CharSequenceTranslator merging this translator with the others.
138139
*/
139140
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) {
140141
final CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];

src/main/java/org/apache/commons/text/translate/CodePointTranslator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public final int translate(final CharSequence input, final int index, final Writ
4444
/**
4545
* Translates the specified code point into another.
4646
*
47-
* @param codePoint int character input to translate
48-
* @param writer Writer to optionally push the translated output to
49-
* @return boolean as to whether translation occurred or not
50-
* @throws IOException if and only if the Writer produces an IOException
47+
* @param codePoint int character input to translate.
48+
* @param writer Writer to optionally push the translated output to.
49+
* @return boolean as to whether translation occurred or not.
50+
* @throws IOException if and only if the Writer produces an IOException.
5151
*/
5252
public abstract boolean translate(int codePoint, Writer writer) throws IOException;
5353

src/main/java/org/apache/commons/text/translate/EntityArrays.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ public class EntityArrays {
440440
/**
441441
* Inverts an escape Map into an unescape Map.
442442
*
443-
* @param map Map<String, String> to be inverted
444-
* @return Map<String, String> inverted array
443+
* @param map Map<String, String> to be inverted.
444+
* @return Map<String, String> inverted array.
445445
*/
446446
public static Map<CharSequence, CharSequence> invert(final Map<CharSequence, CharSequence> map) {
447447
return map.entrySet().stream().collect(Collectors.toMap(Entry::getValue, Entry::getKey));

src/main/java/org/apache/commons/text/translate/JavaUnicodeEscaper.java

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.text.translate;
1819

1920
/**
@@ -26,9 +27,8 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
2627
/**
2728
* Constructs a {@code JavaUnicodeEscaper} above the specified value (exclusive).
2829
*
29-
* @param codePoint
30-
* above which to escape
31-
* @return The newly created {@code UnicodeEscaper} instance
30+
* @param codePoint above which to escape.
31+
* @return The newly created {@code UnicodeEscaper} instance.
3232
*/
3333
public static JavaUnicodeEscaper above(final int codePoint) {
3434
return outsideOf(0, codePoint);
@@ -37,9 +37,8 @@ public static JavaUnicodeEscaper above(final int codePoint) {
3737
/**
3838
* Constructs a {@code JavaUnicodeEscaper} below the specified value (exclusive).
3939
*
40-
* @param codePoint
41-
* below which to escape
42-
* @return The newly created {@code UnicodeEscaper} instance
40+
* @param codePoint below which to escape.
41+
* @return The newly created {@code UnicodeEscaper} instance.
4342
*/
4443
public static JavaUnicodeEscaper below(final int codePoint) {
4544
return outsideOf(codePoint, Integer.MAX_VALUE);
@@ -48,11 +47,9 @@ public static JavaUnicodeEscaper below(final int codePoint) {
4847
/**
4948
* Constructs a {@code JavaUnicodeEscaper} between the specified values (inclusive).
5049
*
51-
* @param codePointLow
52-
* above which to escape
53-
* @param codePointHigh
54-
* below which to escape
55-
* @return The newly created {@code UnicodeEscaper} instance
50+
* @param codePointLow above which to escape.
51+
* @param codePointHigh below which to escape.
52+
* @return The newly created {@code UnicodeEscaper} instance.
5653
*/
5754
public static JavaUnicodeEscaper between(final int codePointLow, final int codePointHigh) {
5855
return new JavaUnicodeEscaper(codePointLow, codePointHigh, true);
@@ -61,27 +58,21 @@ public static JavaUnicodeEscaper between(final int codePointLow, final int codeP
6158
/**
6259
* Constructs a {@code JavaUnicodeEscaper} outside of the specified values (exclusive).
6360
*
64-
* @param codePointLow
65-
* below which to escape
66-
* @param codePointHigh
67-
* above which to escape
68-
* @return The newly created {@code UnicodeEscaper} instance
61+
* @param codePointLow below which to escape.
62+
* @param codePointHigh above which to escape.
63+
* @return The newly created {@code UnicodeEscaper} instance.
6964
*/
7065
public static JavaUnicodeEscaper outsideOf(final int codePointLow, final int codePointHigh) {
7166
return new JavaUnicodeEscaper(codePointLow, codePointHigh, false);
7267
}
7368

7469
/**
75-
* Constructs a {@code JavaUnicodeEscaper} for the specified range. This is the underlying method for the
76-
* other constructors/builders. The {@code below} and {@code above} boundaries are inclusive when
77-
* {@code between} is {@code true} and exclusive when it is {@code false}.
70+
* Constructs a {@code JavaUnicodeEscaper} for the specified range. This is the underlying method for the other constructors/builders. The {@code below} and
71+
* {@code above} boundaries are inclusive when {@code between} is {@code true} and exclusive when it is {@code false}.
7872
*
79-
* @param below
80-
* int value representing the lowest code point boundary
81-
* @param above
82-
* int value representing the highest code point boundary
83-
* @param between
84-
* whether to escape between the boundaries or outside them
73+
* @param below int value representing the lowest code point boundary.
74+
* @param above int value representing the highest code point boundary.
75+
* @param between whether to escape between the boundaries or outside them.
8576
*/
8677
public JavaUnicodeEscaper(final int below, final int above, final boolean between) {
8778
super(below, above, between);
@@ -90,14 +81,12 @@ public JavaUnicodeEscaper(final int below, final int above, final boolean betwee
9081
/**
9182
* Converts the given code point to a hexadecimal string of the form {@code "\\uXXXX\\uXXXX"}.
9283
*
93-
* @param codePoint
94-
* a Unicode code point
95-
* @return The hexadecimal string for the given code point
84+
* @param codePoint a Unicode code point.
85+
* @return The hexadecimal string for the given code point.
9686
*/
9787
@Override
9888
protected String toUtf16Escape(final int codePoint) {
9989
final char[] surrogatePair = Character.toChars(codePoint);
10090
return "\\u" + hex(surrogatePair[0]) + "\\u" + hex(surrogatePair[1]);
10191
}
102-
10392
}

src/main/java/org/apache/commons/text/translate/LookupTranslator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ public class LookupTranslator extends CharSequenceTranslator {
4242

4343
/**
4444
* Constructs the lookup table to be used in translation.
45-
*
45+
* <p>
4646
* Note that, as of Lang 3.1 (the origin of this code), the key to the lookup table is converted to a {@link String}. This is because we need the key to
4747
* support hashCode and equals(Object), allowing it to be the key for a HashMap. See LANG-882.
48+
* </p>
4849
*
4950
* @param lookupMap Map&lt;CharSequence, CharSequence&gt; table of translator mappings, may not be null.
5051
*/

src/main/java/org/apache/commons/text/translate/NumericEntityEscaper.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public class NumericEntityEscaper extends CodePointTranslator {
3131
/**
3232
* Constructs a {@code NumericEntityEscaper} above the specified value (exclusive).
3333
*
34-
* @param codePoint above which to escape
35-
* @return The newly created {@code NumericEntityEscaper} instance
34+
* @param codePoint above which to escape.
35+
* @return The newly created {@code NumericEntityEscaper} instance.
3636
*/
3737
public static NumericEntityEscaper above(final int codePoint) {
3838
return outsideOf(0, codePoint);
@@ -41,8 +41,8 @@ public static NumericEntityEscaper above(final int codePoint) {
4141
/**
4242
* Constructs a {@code NumericEntityEscaper} below the specified value (exclusive).
4343
*
44-
* @param codePoint below which to escape
45-
* @return The newly created {@code NumericEntityEscaper} instance
44+
* @param codePoint below which to escape.
45+
* @return The newly created {@code NumericEntityEscaper} instance.
4646
*/
4747
public static NumericEntityEscaper below(final int codePoint) {
4848
return outsideOf(codePoint, Integer.MAX_VALUE);
@@ -51,9 +51,9 @@ public static NumericEntityEscaper below(final int codePoint) {
5151
/**
5252
* Constructs a {@code NumericEntityEscaper} between the specified values (inclusive).
5353
*
54-
* @param codePointLow above which to escape
55-
* @param codePointHigh below which to escape
56-
* @return The newly created {@code NumericEntityEscaper} instance
54+
* @param codePointLow above which to escape.
55+
* @param codePointHigh below which to escape.
56+
* @return The newly created {@code NumericEntityEscaper} instance.
5757
*/
5858
public static NumericEntityEscaper between(final int codePointLow, final int codePointHigh) {
5959
return new NumericEntityEscaper(codePointLow, codePointHigh, true);
@@ -62,9 +62,9 @@ public static NumericEntityEscaper between(final int codePointLow, final int cod
6262
/**
6363
* Constructs a {@code NumericEntityEscaper} outside of the specified values (exclusive).
6464
*
65-
* @param codePointLow below which to escape
66-
* @param codePointHigh above which to escape
67-
* @return The newly created {@code NumericEntityEscaper} instance
65+
* @param codePointLow below which to escape.
66+
* @param codePointHigh above which to escape.
67+
* @return The newly created {@code NumericEntityEscaper} instance.
6868
*/
6969
public static NumericEntityEscaper outsideOf(final int codePointLow, final int codePointHigh) {
7070
return new NumericEntityEscaper(codePointLow, codePointHigh, false);
@@ -89,9 +89,9 @@ public NumericEntityEscaper() {
8989
* and {@code above} boundaries are inclusive when {@code between} is
9090
* {@code true} and exclusive when it is {@code false}.
9191
*
92-
* @param below int value representing the lowest code point boundary
93-
* @param above int value representing the highest code point boundary
94-
* @param between whether to escape between the boundaries or outside them
92+
* @param below int value representing the lowest code point boundary.
93+
* @param above int value representing the highest code point boundary.
94+
* @param between whether to escape between the boundaries or outside them.
9595
*/
9696
private NumericEntityEscaper(final int below, final int above, final boolean between) {
9797
this.range = Range.of(below, above);

src/main/java/org/apache/commons/text/translate/NumericEntityUnescaper.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,25 @@ public enum OPTION {
6363
/**
6464
* Creates a UnicodeUnescaper.
6565
*
66-
* The constructor takes a list of options, only one type of which is currently
67-
* available (whether to allow, error or ignore the semicolon on the end of a
66+
* The constructor takes a list of options, only one type of which is currently available (whether to allow, error or ignore the semicolon on the end of a
6867
* numeric entity to being missing).
69-
*
68+
* <p>
7069
* For example, to support numeric entities without a ';':
71-
* new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)
70+
* </p>
71+
*
72+
* <pre>
73+
* new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)
74+
* </pre>
75+
* <p>
7276
* and to throw an IllegalArgumentException when they're missing:
73-
* new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)
77+
* </p>
7478
*
79+
* <pre>
80+
* new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)
81+
* </pre>
82+
* <p>
7583
* Note that the default behavior is to ignore them.
84+
* </p>
7685
*
7786
* @param options to apply to this unescaper
7887
*/
@@ -83,8 +92,8 @@ public NumericEntityUnescaper(final OPTION... options) {
8392
/**
8493
* Tests whether the passed in option is currently set.
8594
*
86-
* @param option to check state of
87-
* @return whether the option is set
95+
* @param option to check state of.
96+
* @return whether the option is set.
8897
*/
8998
public boolean isSet(final OPTION option) {
9099
return options.contains(option);

src/main/java/org/apache/commons/text/translate/OctalUnescaper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public OctalUnescaper() {
4141
/**
4242
* Tests if the given char is an octal digit. Octal digits are the character representations of the digits 0 to 7.
4343
*
44-
* @param ch the char to check
45-
* @return true if the given char is the character representation of one of the digits from 0 to 7
44+
* @param ch the char to check.
45+
* @return true if the given char is the character representation of one of the digits from 0 to 7.
4646
*/
4747
private boolean isOctalDigit(final char ch) {
4848
return ch >= '0' && ch <= '7';
@@ -51,8 +51,8 @@ private boolean isOctalDigit(final char ch) {
5151
/**
5252
* Tests if the given char is the character representation of one of the digit from 0 to 3.
5353
*
54-
* @param ch the char to check
55-
* @return true if the given char is the character representation of one of the digits from 0 to 3
54+
* @param ch the char to check.
55+
* @return true if the given char is the character representation of one of the digits from 0 to 3.
5656
*/
5757
private boolean isZeroToThree(final char ch) {
5858
return ch >= '0' && ch <= '3';

src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private String getClassName() {
3737

3838
/**
3939
* {@inheritDoc}
40-
* @throws IllegalArgumentException if {@code index != 0}
40+
* @throws IllegalArgumentException if {@code index != 0}.
4141
*/
4242
@Override
4343
public int translate(final CharSequence input, final int index, final Writer writer) throws IOException {
@@ -54,9 +54,9 @@ public int translate(final CharSequence input, final int index, final Writer wri
5454
/**
5555
* Translates whole set of code points passed in input.
5656
*
57-
* @param input CharSequence that is being translated
58-
* @param writer Writer to translate the text to
59-
* @throws IOException if and only if the Writer produces an IOException
57+
* @param input CharSequence that is being translated.
58+
* @param writer Writer to translate the text to.
59+
* @throws IOException if and only if the Writer produces an IOException.
6060
*/
6161
abstract void translateWhole(CharSequence input, Writer writer) throws IOException;
6262
}

0 commit comments

Comments
 (0)