com.jfw.util
Class Format

java.lang.Object
  extended by com.jfw.util.Format

public final class Format
extends java.lang.Object

Format strings for various uses. All methods are static and thread safe.


Constructor Summary
Format()
           
 
Method Summary
static java.lang.String doubleSingleQuot(java.lang.String toChange)
          Double single quot.
static java.lang.Object getNotEmpty(java.lang.Object toCheck, java.lang.Object defaultValue)
          Return a not null object.
static java.lang.Object getNotNull(java.lang.Object toCheck)
          Return a not null object.
static java.lang.Object getNotNull(java.lang.Object toCheck, java.lang.Object defaultValue)
          Return a not null object.
static java.lang.Object getNotNullString(java.lang.Object toCheck)
          Return a not null object.
static java.lang.String getNotNullString(java.lang.Object toCheck, java.lang.String defaultValue)
          Return a not null object.
static java.lang.Object getNotNullStringUC(java.lang.Object toCheck)
          Return a not null object.
static java.lang.String getNotNullStringUC(java.lang.Object toCheck, java.lang.String defaultValue)
          Return a not null object.
static boolean isEmpty(java.lang.String toCheck)
          Check if a string is blank or null.
static java.lang.String null2Blank(java.lang.String toCheck)
          Return the blank string if toCheck is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format()
Method Detail

doubleSingleQuot

public static java.lang.String doubleSingleQuot(java.lang.String toChange)
Double single quot.

Parameters:
toChange - string to change.
Returns:
changed string.

getNotNull

public static java.lang.Object getNotNull(java.lang.Object toCheck,
                                          java.lang.Object defaultValue)
Return a not null object.

Parameters:
toCheck - object to check.
defaultValue - default value in other cases.
Returns:
toCheck if toCheck is not null and not an instance of NullObject, defaultValue in other cases.

getNotNull

public static java.lang.Object getNotNull(java.lang.Object toCheck)
Return a not null object.

Parameters:
toCheck - object to check.
Returns:
toCheck if toCheck is not null and not an instance of NullObject, blank string in other cases.

getNotNullString

public static java.lang.String getNotNullString(java.lang.Object toCheck,
                                                java.lang.String defaultValue)
Return a not null object.

Parameters:
toCheck - object to check.
defaultValue - default value in other cases.
Returns:
toCheck.toString() if toCheck is not null and not an instance of NullObject, defaultValue in other cases.

getNotNullString

public static java.lang.Object getNotNullString(java.lang.Object toCheck)
Return a not null object.

Parameters:
toCheck - object to check.
Returns:
toCheck.toString() if toCheck is not null and not an instance of NullObject, blank string in other cases.

getNotNullStringUC

public static java.lang.String getNotNullStringUC(java.lang.Object toCheck,
                                                  java.lang.String defaultValue)
Return a not null object.

Parameters:
toCheck - object to check.
defaultValue - default value in other cases.
Returns:
toCheck.toString().toUpperCase() if toCheck is not null and not an instance of NullObject, defaultValue in other cases.

getNotNullStringUC

public static java.lang.Object getNotNullStringUC(java.lang.Object toCheck)
Return a not null object.

Parameters:
toCheck - object to check.
Returns:
toCheck.toString().toUpperCase() if toCheck is not null and not an instance of NullObject, blank string in other cases.

getNotEmpty

public static java.lang.Object getNotEmpty(java.lang.Object toCheck,
                                           java.lang.Object defaultValue)
Return a not null object.

Parameters:
toCheck - object to check.
defaultValue - default value in other cases.
Returns:
toCheck if toCheck is not null and not blank string and not an instance of NullObject, defaultValue in other cases.

null2Blank

public static java.lang.String null2Blank(java.lang.String toCheck)
Return the blank string if toCheck is null.

Parameters:
toCheck - object to check.
Returns:
toCheck if toCheck is not null, the blank string in other cases.

isEmpty

public static boolean isEmpty(java.lang.String toCheck)
Check if a string is blank or null. If the object is not null then the trim method is applied to the string before check if is a blank string.

Returns:
true if the string is blank or null, false in other cases.