This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e5a7df6f6e4 (chores) camel-core: fixed minor documentation issues in
StringHelper
e5a7df6f6e4 is described below
commit e5a7df6f6e465bb3f4c5fdae9e99fbdf4023d1e2
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Aug 27 13:08:35 2024 +0200
(chores) camel-core: fixed minor documentation issues in StringHelper
---
.../java/org/apache/camel/util/StringHelper.java | 44 +++++++++++-----------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git
a/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java
b/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java
index 68567872589..5dab4e1a350 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java
@@ -290,7 +290,7 @@ public final class StringHelper {
return false;
}
- // for the simple language the expression start token could be "${"
+ // for the simple language, the expression start token could be "${"
if ("simple".equalsIgnoreCase(language) && expression.contains("${")) {
return true;
}
@@ -306,7 +306,7 @@ public final class StringHelper {
* Replaces the first from token in the given input string.
* <p/>
* This implementation is not recursive, not does it check for tokens in
the replacement string. If from or to is
- * null then the input string is returned as-is
+ * null, then the input string is returned as-is
*
* @param input the input string
* @param from the from string
@@ -328,7 +328,7 @@ public final class StringHelper {
}
/**
- * Creates a json tuple with the given name/value pair.
+ * Creates a JSON tuple with the given name/value pair.
*
* @param name the name
* @param value the value
@@ -687,7 +687,7 @@ public final class StringHelper {
}
/**
- * Returns the string after the given token, or the default value
+ * Returns the string after the given token or the default value
*
* @param text the text
* @param after the token
@@ -717,7 +717,7 @@ public final class StringHelper {
}
/**
- * Returns the string after the the last occurrence of the given token
+ * Returns the string after the last occurrence of the given token
*
* @param text the text
* @param after the token
@@ -735,7 +735,7 @@ public final class StringHelper {
}
/**
- * Returns the string after the the last occurrence of the given token, or
the default value
+ * Returns the string after the last occurrence of the given token, or the
default value
*
* @param text the text
* @param after the token
@@ -779,12 +779,13 @@ public final class StringHelper {
}
/**
- * Returns the string before the given token, or the default value
+ * Returns the string before the given token or the default value
*
* @param text the text
* @param before the token
- * @param defaultValue the value to return if text does not contain the
token
- * @return the text before the token, or the supplied
defaultValue if text does not contain the token
+ * @param defaultValue the value to return if the text does not contain
the token
+ * @return the text before the token, or the supplied
defaultValue if the text does not contain the
+ * token
*/
public static String before(String text, char before, String defaultValue)
{
if (text == null) {
@@ -816,7 +817,7 @@ public final class StringHelper {
*
* @param text the text
* @param before the token
- * @return the text before the token, or <tt>null</tt> if text does
not contain the token
+ * @return the text before the token, or <tt>null</tt> if the text
does not contain the token
*/
public static String beforeLast(String text, String before) {
if (text == null) {
@@ -831,8 +832,9 @@ public final class StringHelper {
*
* @param text the text
* @param before the token
- * @param defaultValue the value to return if text does not contain the
token
- * @return the text before the token, or the supplied
defaultValue if text does not contain the token
+ * @param defaultValue the value to return if the text does not contain
the token
+ * @return the text before the token, or the supplied
defaultValue if the text does not contain the
+ * token
*/
public static String beforeLast(String text, String before, String
defaultValue) {
String answer = beforeLast(text, before);
@@ -845,7 +847,7 @@ public final class StringHelper {
* @param text the text
* @param after the before token
* @param before the after token
- * @return the text between the tokens, or <tt>null</tt> if text
does not contain the tokens
+ * @return the text between the tokens, or <tt>null</tt> if the
text does not contain the tokens
*/
public static String between(final String text, String after, String
before) {
String ret = after(text, after);
@@ -904,10 +906,10 @@ public final class StringHelper {
/**
* Returns the string between the most outer pair of tokens
* <p/>
- * The number of token pairs must be evenly, eg there must be same number
of before and after tokens, otherwise
+ * The number of token pairs must be even, e.g., there must be same number
of before and after tokens, otherwise
* <tt>null</tt> is returned
* <p/>
- * This implementation skips matching when the text is either single or
double quoted. For example:
+ * This implementation skips matching when the text is either single or
double-quoted. For example:
* <tt>${body.matches("foo('bar')")</tt> Will not match the parenthesis
from the quoted text.
*
* @param text the text
@@ -1011,7 +1013,7 @@ public final class StringHelper {
* ClassNotFoundException
*
* @param name the class name
- * @return normalized classname that can be load by a class loader.
+ * @return normalized class name that can be load by a class loader.
*/
public static String normalizeClassName(String name) {
StringBuilder sb = new StringBuilder(name.length());
@@ -1118,7 +1120,7 @@ public final class StringHelper {
}
/**
- * Outputs the bytes in human readable format in units of KB,MB,GB etc.
+ * Outputs the bytes in human-readable format in units of KB,MB,GB etc.
*
* @param locale The locale to apply during formatting. If l is {@code
null} then no localization is applied.
* @param bytes number of bytes
@@ -1136,7 +1138,7 @@ public final class StringHelper {
}
/**
- * Outputs the bytes in human readable format in units of KB,MB,GB etc.
+ * Outputs the bytes in human-readable format in units of KB,MB,GB etc.
*
* The locale always used is the one returned by {@link
java.util.Locale#getDefault()}.
*
@@ -1233,7 +1235,7 @@ public final class StringHelper {
}
/**
- * Does the string starts with the given prefix (ignore case).
+ * Does the string start with the given prefix (ignoring the case).
*
* @param text the string
* @param prefix the prefix
@@ -1247,7 +1249,7 @@ public final class StringHelper {
}
/**
- * Converts the value to an enum constant value that is in the form of
upper cased with underscore.
+ * Converts the value to an enum constant value that is in the form of
upper-cased with underscore.
*/
public static String asEnumConstantValue(final String value) {
if (value == null || value.isEmpty()) {
@@ -1288,7 +1290,7 @@ public final class StringHelper {
*
* @param text the text
* @param search the string to search
- * @return an integer reporting the number of occurrence of the
searched string in to the text
+ * @return an integer reporting the occurrences of the searched
string in to the text
*/
public static int countOccurrence(String text, String search) {
int lastIndex = 0;