|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ivata.mask.util.StringHandling
StringHandling is a helper class for handling Strings. It contains methods
for converting to and from different data types, and for handling
null conditions.
Don't create an instance of this class; use the static final methods.
| Method Summary | |
static java.lang.Boolean |
booleanValue(java.lang.String convertToBoolean)
This method works like Boolean.valueOf, but allows
null values without an exception, and also translates the
string "on" as true which is useful for
converting request values. |
static java.lang.String |
generateRandomString(int length)
Generates a random string of specified length, when the length 0 or less, defaults to 8 The string only consists of letters and numbers and the first character is always a letter. |
static java.lang.String |
getNotNull(java.lang.Object check)
If the string supplied is not null, return the string,
otherwise return the empty string. |
static java.lang.String |
getNotNull(java.lang.Object check,
java.lang.String nullString)
Handle null objects in a standard way. |
static java.lang.Integer |
integerValue(java.lang.String convertToInteger)
This method works like Integer.valueOf, but allows
null values without an exception. |
static boolean |
isNullOrEmpty(java.lang.String checkString)
This method does just what it says: evaluates the String you give it and returns true if it is null or an empty
string. |
static java.lang.String |
toString(java.lang.Integer convert)
Works like the standard Integer.toString() except that it
allows null values, returning a null string
in this case. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static java.lang.Boolean booleanValue(java.lang.String convertToBoolean)
This method works like Boolean.valueOf, but allows
null values without an exception, and also translates the
string "on" as true which is useful for
converting request values.
convertToBoolean - a String to be converted to a boolean value. null
Strings return in a null
Boolean returned.
null if convertToBoolean is
null or if convertToBoolean equals
the string "null". It returns a
Boolean true value if the string is equal to
"true" or "on" (ignoring case),
otherwise a Boolean
false value is returned.public static java.lang.String generateRandomString(int length)
Generates a random string of specified length, when the length 0 or less, defaults to 8 The string only consists of letters and numbers and the first character is always a letter.
length - the length of the string to generate.
public static java.lang.String getNotNull(java.lang.Object check)
If the string supplied is not null, return the string,
otherwise return the empty string.
check - an object to compare against null
checkString is
null, otherwise the value of
checkString unaltered.getNotNull(Object o, String nullString)
public static java.lang.String getNotNull(java.lang.Object check,
java.lang.String nullString)
Handle null objects in a standard way. If the object you pass is null,
then the string nullString will be returned.
check - an object to compare against nullnullString - the string to return if o is null
getNotNull(Object check)public static java.lang.Integer integerValue(java.lang.String convertToInteger)
This method works like Integer.valueOf, but allows
null values without an exception.
convertToInteger - a String to be converted to an integer number.
null Strings return in a null
Integer
returned.
null if convertToInteger is
null or if convertToInteger equals
the string value "null", otherwise an integer representing the
base 10 value of convertToInteger.Integer.valueOf(String convertToInteger)public static boolean isNullOrEmpty(java.lang.String checkString)
This method does just what it says: evaluates the String you give it and
returns true if it is null or an empty
string.
checkString - the string to check for being null or empty.
true if checkString is
null or an empty stringpublic static java.lang.String toString(java.lang.Integer convert)
Works like the standard Integer.toString() except that it
allows null values, returning a null string
in this case.
convert - the Integer you want to convert to a string.
null if the integer convert. is
null, otherwise the string equivalent of
convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||