Mike Kolesnik has uploaded a new change for review.

Change subject: webadmin: Add StringUtils.is{,Not}Empty
......................................................................

webadmin: Add StringUtils.is{,Not}Empty

Methods added to the extrenal class until StringUtils is supported
normally.

Change-Id: Ia26668e73a42523f412b07ca3bcc8ca0578aa550
Related-To: https://bugzilla.redhat.com/1064749
Signed-off-by: Mike Kolesnik <mkole...@redhat.com>
---
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java
1 file changed, 48 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/26020/1

diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java
index 1d4383f..2c9b91f 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/external/StringUtils.java
@@ -20,6 +20,54 @@
 import java.util.List;
 
 public class StringUtils {
+
+    /**
+     * <p>
+     * Checks if a String is empty ("") or null.
+     * </p>
+     *
+     * <pre>
+     * StringUtils.isEmpty(null)      = true
+     * StringUtils.isEmpty("")        = true
+     * StringUtils.isEmpty(" ")       = false
+     * StringUtils.isEmpty("bob")     = false
+     * StringUtils.isEmpty("  bob  ") = false
+     * </pre>
+     *
+     * <p>
+     * NOTE: This method changed in Lang version 2.0. It no longer trims the 
String. That functionality is available in
+     * isBlank().
+     * </p>
+     *
+     * @param str
+     *            the String to check, may be null
+     * @return <code>true</code> if the String is empty or null
+     */
+    public static boolean isEmpty(String str) {
+        return str == null || str.length() == 0;
+    }
+
+    /**
+     * <p>
+     * Checks if a String is not empty ("") and not null.
+     * </p>
+     *
+     * <pre>
+     * StringUtils.isNotEmpty(null)      = false
+     * StringUtils.isNotEmpty("")        = false
+     * StringUtils.isNotEmpty(" ")       = true
+     * StringUtils.isNotEmpty("bob")     = true
+     * StringUtils.isNotEmpty("  bob  ") = true
+     * </pre>
+     *
+     * @param str
+     *            the String to check, may be null
+     * @return <code>true</code> if the String is not empty and not null
+     */
+    public static boolean isNotEmpty(String str) {
+        return !StringUtils.isEmpty(str);
+    }
+
     /**
      * Joins the Strings of the provided array into a single String.
      *


-- 
To view, visit http://gerrit.ovirt.org/26020
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia26668e73a42523f412b07ca3bcc8ca0578aa550
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <mkole...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to