diff --git a/src/main/java/com/fanruan/api/util/ArrayKit.java b/src/main/java/com/fanruan/api/util/ArrayKit.java new file mode 100644 index 0000000..34cb26e --- /dev/null +++ b/src/main/java/com/fanruan/api/util/ArrayKit.java @@ -0,0 +1,9 @@ +package com.fanruan.api.util; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-16 + */ +public class ArrayKit { +} diff --git a/src/main/java/com/fanruan/api/util/GeneralUtils.java b/src/main/java/com/fanruan/api/util/GeneralKit.java similarity index 96% rename from src/main/java/com/fanruan/api/util/GeneralUtils.java rename to src/main/java/com/fanruan/api/util/GeneralKit.java index 1db7f3f..6e2950f 100644 --- a/src/main/java/com/fanruan/api/util/GeneralUtils.java +++ b/src/main/java/com/fanruan/api/util/GeneralKit.java @@ -7,7 +7,7 @@ import java.io.IOException; * @version 10.0 * Created by richie on 2019-08-09 */ -public class GeneralUtils { +public class GeneralKit { /** * 返回系统的首选MAC地址 diff --git a/src/main/java/com/fanruan/api/util/StringKit.java b/src/main/java/com/fanruan/api/util/StringKit.java new file mode 100644 index 0000000..f3e47df --- /dev/null +++ b/src/main/java/com/fanruan/api/util/StringKit.java @@ -0,0 +1,89 @@ +package com.fanruan.api.util; + +import com.fr.stable.StringUtils; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-16 + * 字符串工具类 + */ +public class StringKit { + + public static final String EMPTY = ""; + public static final String BLANK = " "; + + /** + *

检查一个字符串是否是空字符串

+ *

+ *

+     * StringKit.isEmpty(null)      = true
+     * StringKit.isEmpty("")        = true
+     * StringKit.isEmpty(" ")       = false
+     * StringKit.isEmpty("bob")     = false
+     * StringKit.isEmpty("  bob  ") = false
+     * 
+ *

+ * + * @param text 被检查的字符串,可能为null + * @return 如果字符串为空或者是null则返回true,否则返回false + */ + public static boolean isEmpty(String text) { + return StringUtils.isEmpty(text); + } + + /** + *

检查一个字符串是否不为空字符串

+ *

+ *

+     * StringKit.isNotEmpty(null)      = false
+     * StringKit.isNotEmpty("")        = false
+     * StringKit.isNotEmpty(" ")       = true
+     * StringKit.isNotEmpty("bob")     = true
+     * StringKit.isNotEmpty("  bob  ") = true
+     * 
+ * + * @param text 被检查的字符串,可能是null + * @return 如果字符串不为空且不是null则返回true,否则返回false + */ + public static boolean isNotEmpty(String text) { + return StringUtils.isNotEmpty(text); + } + + /** + *

检查一个字符串是否为空白字符串

+ *

+ *

+     * StringKit.isBlank(null)      = true
+     * StringKit.isBlank("")        = true
+     * StringKit.isBlank(" ")       = true
+     * StringKit.isBlank("bob")     = false
+     * StringKit.isBlank("  bob  ") = false
+     * 
+ * + * @param text 被检查的字符串 + * @return 如果字符串为空、空格符或者null那么返回true,否则返回false + */ + public static boolean isBlank(String text) { + return StringUtils.isBlank(text); + } + + /** + *

检查一个字符串是否不是空白字符串

+ *

+ *

+     * StringKit.isNotBlank(null)      = false
+     * StringKit.isNotBlank("")        = false
+     * StringKit.isNotBlank(" ")       = false
+     * StringKit.isNotBlank("bob")     = true
+     * StringKit.isNotBlank("  bob  ") = true
+     * 
+ * + * @param text 被检查的字符串 + * @return 如果字符串不是空字符串、空格符以及null那么就返回true,否则返回false + */ + public static boolean isNotBlank(String text) { + return StringUtils.isNotBlank(text); + } + +} diff --git a/src/test/java/com/fanruan/api/util/GeneralUtilsTest.java b/src/test/java/com/fanruan/api/util/GeneralKitTest.java similarity index 62% rename from src/test/java/com/fanruan/api/util/GeneralUtilsTest.java rename to src/test/java/com/fanruan/api/util/GeneralKitTest.java index 6bd7235..cbead61 100644 --- a/src/test/java/com/fanruan/api/util/GeneralUtilsTest.java +++ b/src/test/java/com/fanruan/api/util/GeneralKitTest.java @@ -9,10 +9,10 @@ import org.junit.Test; * @version 10.0 * Created by richie on 2019-08-09 */ -public class GeneralUtilsTest extends Prepare { +public class GeneralKitTest extends Prepare { @Test public void getMacAddress() throws Exception{ - Assert.assertEquals(GeneralUtils.getMacAddress(), com.fr.general.GeneralUtils.getMacAddress()); + Assert.assertEquals(GeneralKit.getMacAddress(), com.fr.general.GeneralUtils.getMacAddress()); } } \ No newline at end of file