Skip to content

Commit ed14c51

Browse files
committed
Add comments to string utility methods
1 parent 19a8ac4 commit ed14c51

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package {{invokerPackage}};
22

33
public class StringUtil {
4+
/**
5+
* Check if the given array contains the given value (with case-insensitive comparison).
6+
*
7+
* @param array The array
8+
* @param value The value to search
9+
* @return true if the array contains the value
10+
*/
411
public static boolean containsIgnoreCase(String[] array, String value) {
512
for (String str : array) {
613
if (value == null && str == null) return true;
@@ -9,6 +16,17 @@ public class StringUtil {
916
return false;
1017
}
1118

19+
/**
20+
* Join an array of strings with the given separator.
21+
* <p>
22+
* Note: This might be replaced by utility method from commons-lang or guava someday
23+
* if one of those libraries is added as dependency.
24+
* </p>
25+
*
26+
* @param array The array of strings
27+
* @param separator The separator
28+
* @return the resulting string
29+
*/
1230
public static String join(String[] array, String separator) {
1331
int len = array.length;
1432
if (len == 0) return "";

samples/client/petstore/java/src/main/java/io/swagger/client/StringUtil.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package io.swagger.client;
22

33
public class StringUtil {
4+
/**
5+
* Check if the given array contains the given value (with case-insensitive comparison).
6+
*
7+
* @param array The array
8+
* @param value The value to search
9+
* @return true if the array contains the value
10+
*/
411
public static boolean containsIgnoreCase(String[] array, String value) {
512
for (String str : array) {
613
if (value == null && str == null) return true;
@@ -9,6 +16,17 @@ public static boolean containsIgnoreCase(String[] array, String value) {
916
return false;
1017
}
1118

19+
/**
20+
* Join an array of strings with the given separator.
21+
* <p>
22+
* Note: This might be replaced by utility method from commons-lang or guava someday
23+
* if one of those libraries is added as dependency.
24+
* </p>
25+
*
26+
* @param array The array of strings
27+
* @param separator The separator
28+
* @return the resulting string
29+
*/
1230
public static String join(String[] array, String separator) {
1331
int len = array.length;
1432
if (len == 0) return "";

0 commit comments

Comments
 (0)