com.netmera.mobile.util
Class StringUtils

java.lang.Object
  extended by com.netmera.mobile.util.StringUtils

public class StringUtils
extends java.lang.Object


Field Summary
static java.lang.String EMPTY
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.Object[] convertCollectionsToArray(java.util.Collection<?> collection)
           
static java.lang.String convertInputStreamToString(java.io.InputStream in)
           
static java.util.Date convertStringToDate(java.lang.String dateStr)
          Converts String into Date
static boolean isNotBlank(java.lang.String str)
          Checks if a String is not empty (""), not null and not whitespace only.
static java.lang.String join(java.lang.Object[] array, java.lang.String separator)
           Joins the elements of the provided array into a single String containing the provided list of elements.
static
<T> T
nullCheck(T argument)
           
static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.lang.String EMPTY
See Also:
Constant Field Values
Constructor Detail

StringUtils

public StringUtils()
Method Detail

convertCollectionsToArray

public static java.lang.Object[] convertCollectionsToArray(java.util.Collection<?> collection)

substringAfterLast

public static java.lang.String substringAfterLast(java.lang.String str,
                                                  java.lang.String separator)

convertStringToDate

public static java.util.Date convertStringToDate(java.lang.String dateStr)
Converts String into Date


nullCheck

public static <T> T nullCheck(T argument)

convertInputStreamToString

public static java.lang.String convertInputStreamToString(java.io.InputStream in)
                                                   throws java.io.IOException
Throws:
java.io.IOException

isNotBlank

public static boolean isNotBlank(java.lang.String str)
Checks if a String is not empty (""), not null and not whitespace only.
 StringUtils.isNotBlank(null)      = false
 StringUtils.isNotBlank("")        = false
 StringUtils.isNotBlank(" ")       = false
 StringUtils.isNotBlank("bob")     = true
 StringUtils.isNotBlank("  bob  ") = true
 

Parameters:
str - - String to check
Returns:
true if the String is not empty and not null and not whitespace

join

public static java.lang.String join(java.lang.Object[] array,
                                    java.lang.String separator)

Joins the elements of the provided array into a single String containing the provided list of elements.

No delimiter is added before or after the list. A null separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.

 StringUtils.join(null, *)                = null
 StringUtils.join([], *)                  = ""
 StringUtils.join([null], *)              = ""
 StringUtils.join(["a", "b", "c"], "--")  = "a--b--c"
 StringUtils.join(["a", "b", "c"], null)  = "abc"
 StringUtils.join(["a", "b", "c"], "")    = "abc"
 StringUtils.join([null, "", "a"], ',')   = ",,a"
 

Parameters:
array - the array of values to join together, may be null
separator - the separator character to use, null treated as ""
Returns:
the joined String, null if null array input