From ed14c515bf73b5a814a872bc4f1472b6a2f1773c Mon Sep 17 00:00:00 2001 From: xhh Date: Mon, 25 May 2015 16:01:57 +0800 Subject: [PATCH] Add comments to string utility methods --- .../main/resources/Java/StringUtil.mustache | 18 ++++++++++++++++++ .../java/io/swagger/client/StringUtil.java | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache index 536c0b577e4..035d6739dce 100644 --- a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache @@ -1,6 +1,13 @@ package {{invokerPackage}}; public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { if (value == null && str == null) return true; @@ -9,6 +16,17 @@ public class StringUtil { return false; } + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ public static String join(String[] array, String separator) { int len = array.length; if (len == 0) return ""; diff --git a/samples/client/petstore/java/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/src/main/java/io/swagger/client/StringUtil.java index f8be7d04531..5b5af2d5ce0 100644 --- a/samples/client/petstore/java/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,13 @@ package io.swagger.client; public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { if (value == null && str == null) return true; @@ -9,6 +16,17 @@ public class StringUtil { return false; } + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ public static String join(String[] array, String separator) { int len = array.length; if (len == 0) return "";