Skip to content

Commit 1ab3b3f

Browse files
committed
Javadoc
1 parent d4a4b43 commit 1ab3b3f

File tree

2 files changed

+58
-44
lines changed

2 files changed

+58
-44
lines changed

src/main/java/org/apache/commons/lang3/StringUtils.java

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,10 +1478,12 @@ public static int countMatches(final CharSequence str, final CharSequence sub) {
14781478
}
14791479

14801480
/**
1481-
* Returns either the passed in CharSequence, or if the CharSequence is
1482-
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.
1481+
* Returns either the passed in CharSequence, or if the CharSequence is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or
1482+
* {@code null}), the value of {@code defaultStr}.
14831483
*
1484-
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
1484+
* <p>
1485+
* Whitespace is defined by {@link Character#isWhitespace(char)}.
1486+
* </p>
14851487
*
14861488
* <pre>
14871489
* StringUtils.defaultIfBlank(null, "NULL") = "NULL"
@@ -1490,12 +1492,14 @@ public static int countMatches(final CharSequence str, final CharSequence sub) {
14901492
* StringUtils.defaultIfBlank("bat", "NULL") = "bat"
14911493
* StringUtils.defaultIfBlank("", null) = null
14921494
* </pre>
1493-
* @param <T> the specific kind of CharSequence
1494-
* @param str the CharSequence to check, may be null
1495-
* @param defaultStr the default CharSequence to return
1496-
* if {@code str} is whitespace, empty ("") or {@code null}, may be null
1495+
*
1496+
* @param <T> the specific kind of CharSequence
1497+
* @param str the CharSequence to check, may be null
1498+
* @param defaultStr the default CharSequence to return if {@code str} is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code""}) or
1499+
* {@code null}); may be null
14971500
* @return the passed in CharSequence, or the default
14981501
* @see StringUtils#defaultString(String, String)
1502+
* @see #isBlank(CharSequence)
14991503
*/
15001504
public static <T extends CharSequence> T defaultIfBlank(final T str, final T defaultStr) {
15011505
return isBlank(str) ? defaultStr : str;
@@ -2116,12 +2120,16 @@ public static int getFuzzyDistance(final CharSequence term, final CharSequence q
21162120
}
21172121

21182122
/**
2119-
* Returns either the passed in CharSequence, or if the CharSequence is
2120-
* whitespace, empty ("") or {@code null}, the value supplied by {@code defaultStrSupplier}.
2123+
* Returns either the passed in CharSequence, or if the CharSequence is {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or
2124+
* {@code null}), the value supplied by {@code defaultStrSupplier}.
21212125
*
2122-
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
2126+
* <p>
2127+
* Whitespace is defined by {@link Character#isWhitespace(char)}.
2128+
* </p>
21232129
*
2124-
* <p>Caller responsible for thread-safety and exception handling of default value supplier</p>
2130+
* <p>
2131+
* Caller responsible for thread-safety and exception handling of default value supplier
2132+
* </p>
21252133
*
21262134
* <pre>
21272135
* {@code
@@ -2132,12 +2140,14 @@ public static int getFuzzyDistance(final CharSequence term, final CharSequence q
21322140
* StringUtils.getIfBlank("", () -> null) = null
21332141
* StringUtils.getIfBlank("", null) = null
21342142
* }</pre>
2135-
* @param <T> the specific kind of CharSequence
2136-
* @param str the CharSequence to check, may be null
2137-
* @param defaultSupplier the supplier of default CharSequence to return
2138-
* if the input is whitespace, empty ("") or {@code null}, may be null
2143+
*
2144+
* @param <T> the specific kind of CharSequence
2145+
* @param str the CharSequence to check, may be null
2146+
* @param defaultSupplier the supplier of default CharSequence to return if the input is {@link #isBlank(CharSequence) blank} (whitespaces, empty
2147+
* ({@code ""}) or {@code null}); may be null
21392148
* @return the passed in CharSequence, or the default
21402149
* @see StringUtils#defaultString(String, String)
2150+
* @see #isBlank(CharSequence)
21412151
* @since 3.10
21422152
*/
21432153
public static <T extends CharSequence> T getIfBlank(final T str, final Supplier<T> defaultSupplier) {
@@ -3339,9 +3349,11 @@ public static boolean isAlphaSpace(final CharSequence cs) {
33393349
}
33403350

33413351
/**
3342-
* Tests if any of the CharSequences are empty ("") or null or whitespace only.
3352+
* Tests if any of the CharSequences are {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or {@code null}).
33433353
*
3344-
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
3354+
* <p>
3355+
* Whitespace is defined by {@link Character#isWhitespace(char)}.
3356+
* </p>
33453357
*
33463358
* <pre>
33473359
* StringUtils.isAnyBlank((String) null) = true
@@ -3357,8 +3369,9 @@ public static boolean isAlphaSpace(final CharSequence cs) {
33573369
* StringUtils.isAnyBlank("foo", "bar") = false
33583370
* </pre>
33593371
*
3360-
* @param css the CharSequences to check, may be null or empty
3361-
* @return {@code true} if any of the CharSequences are empty or null or whitespace only
3372+
* @param css the CharSequences to check, may be null or empty
3373+
* @return {@code true} if any of the CharSequences are {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or {@code null})
3374+
* @see #isBlank(CharSequence)
33623375
* @since 3.2
33633376
*/
33643377
public static boolean isAnyBlank(final CharSequence... css) {
@@ -3445,9 +3458,7 @@ public static boolean isAsciiPrintable(final CharSequence cs) {
34453458
}
34463459

34473460
/**
3448-
* Tests if a CharSequence is empty (""), null or whitespace only.
3449-
*
3450-
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
3461+
* Tests if a CharSequence is empty ({@code "")}, null, or contains only whitespace as defined by {@link Character#isWhitespace(char)}.
34513462
*
34523463
* <pre>
34533464
* StringUtils.isBlank(null) = true
@@ -3457,7 +3468,7 @@ public static boolean isAsciiPrintable(final CharSequence cs) {
34573468
* StringUtils.isBlank(" bob ") = false
34583469
* </pre>
34593470
*
3460-
* @param cs the CharSequence to check, may be null
3471+
* @param cs the CharSequence to check, may be null
34613472
* @return {@code true} if the CharSequence is null, empty or whitespace only
34623473
* @since 2.0
34633474
* @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
@@ -3594,9 +3605,11 @@ public static boolean isNoneEmpty(final CharSequence... css) {
35943605
}
35953606

35963607
/**
3597-
* Tests if a CharSequence is not empty (""), not null and not whitespace only.
3608+
* Tests if a CharSequence is not {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or {@code null}).
35983609
*
3599-
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
3610+
* <p>
3611+
* Whitespace is defined by {@link Character#isWhitespace(char)}.
3612+
* </p>
36003613
*
36013614
* <pre>
36023615
* StringUtils.isNotBlank(null) = false
@@ -3606,9 +3619,9 @@ public static boolean isNoneEmpty(final CharSequence... css) {
36063619
* StringUtils.isNotBlank(" bob ") = true
36073620
* </pre>
36083621
*
3609-
* @param cs the CharSequence to check, may be null
3610-
* @return {@code true} if the CharSequence is
3611-
* not empty and not null and not whitespace only
3622+
* @param cs the CharSequence to check, may be null
3623+
* @return {@code true} if the CharSequence is not {@link #isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or {@code null})
3624+
* @see #isBlank(CharSequence)
36123625
* @since 2.0
36133626
* @since 3.0 Changed signature from isNotBlank(String) to isNotBlank(CharSequence)
36143627
*/

src/main/java/org/apache/commons/lang3/Validate.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ public static <T> T[] noNullElements(final T[] array, final String message, fina
762762
}
763763

764764
/**
765-
* <p>Validate that the specified argument character sequence is
765+
* <p>Validates that the specified argument character sequence is
766766
* neither {@code null}, a length of zero (no characters), empty
767767
* nor whitespace; otherwise throwing an exception.
768768
*
@@ -784,21 +784,22 @@ public static <T extends CharSequence> T notBlank(final T chars) {
784784
}
785785

786786
/**
787-
* Validate that the specified argument character sequence is
788-
* neither {@code null}, a length of zero (no characters), empty
789-
* nor whitespace; otherwise throwing an exception with the specified
790-
* message.
787+
* Validates that the specified argument character sequence is not {@link StringUtils#isBlank(CharSequence) blank} (whitespaces, empty ({@code ""}) or
788+
* {@code null}); otherwise throwing an exception with the specified message.
791789
*
792-
* <pre>Validate.notBlank(myString, "The string must not be blank");</pre>
790+
* <pre>
791+
* Validate.notBlank(myString, "The string must not be blank");
792+
* </pre>
793793
*
794-
* @param <T> the character sequence type
795-
* @param chars the character sequence to check, validated not null by this method
796-
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null
794+
* @param <T> the character sequence type
795+
* @param chars the character sequence to check, validated not null by this method
796+
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null
797797
* @param values the optional values for the formatted exception message, null array not recommended
798798
* @return the validated character sequence (never {@code null} method for chaining)
799-
* @throws NullPointerException if the character sequence is {@code null}
799+
* @throws NullPointerException if the character sequence is {@code null}
800800
* @throws IllegalArgumentException if the character sequence is blank
801801
* @see #notBlank(CharSequence)
802+
* @see StringUtils#isBlank(CharSequence)
802803
* @since 3.0
803804
*/
804805
public static <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) {
@@ -810,7 +811,7 @@ public static <T extends CharSequence> T notBlank(final T chars, final String me
810811
}
811812

812813
/**
813-
* <p>Validate that the specified argument collection is neither {@code null}
814+
* <p>Validates that the specified argument collection is neither {@code null}
814815
* nor a size of zero (no elements); otherwise throwing an exception.
815816
*
816817
* <pre>Validate.notEmpty(myCollection);</pre>
@@ -830,7 +831,7 @@ public static <T extends Collection<?>> T notEmpty(final T collection) {
830831
}
831832

832833
/**
833-
* <p>Validate that the specified argument map is neither {@code null}
834+
* <p>Validates that the specified argument map is neither {@code null}
834835
* nor a size of zero (no elements); otherwise throwing an exception.
835836
*
836837
* <pre>Validate.notEmpty(myMap);</pre>
@@ -850,7 +851,7 @@ public static <T extends Collection<?>> T notEmpty(final T collection) {
850851
}
851852

852853
/**
853-
* <p>Validate that the specified argument character sequence is
854+
* <p>Validates that the specified argument character sequence is
854855
* neither {@code null} nor a length of zero (no characters);
855856
* otherwise throwing an exception with the specified message.
856857
*
@@ -871,7 +872,7 @@ public static <T extends CharSequence> T notEmpty(final T chars) {
871872
}
872873

873874
/**
874-
* <p>Validate that the specified argument collection is neither {@code null}
875+
* <p>Validates that the specified argument collection is neither {@code null}
875876
* nor a size of zero (no elements); otherwise throwing an exception
876877
* with the specified message.
877878
*
@@ -943,7 +944,7 @@ public static <T extends CharSequence> T notEmpty(final T chars, final String me
943944
}
944945

945946
/**
946-
* <p>Validate that the specified argument array is neither {@code null}
947+
* <p>Validates that the specified argument array is neither {@code null}
947948
* nor a length of zero (no elements); otherwise throwing an exception.
948949
*
949950
* <pre>Validate.notEmpty(myArray);</pre>
@@ -963,7 +964,7 @@ public static <T> T[] notEmpty(final T[] array) {
963964
}
964965

965966
/**
966-
* <p>Validate that the specified argument array is neither {@code null}
967+
* <p>Validates that the specified argument array is neither {@code null}
967968
* nor a length of zero (no elements); otherwise throwing an exception
968969
* with the specified message.
969970
*

0 commit comments

Comments
 (0)