| java.lang.Object com.ivata.mask.util.StringHandling
StringHandling | final public class StringHandling (Code) | |
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.
since: ivata masks 0.4 (2001-12-27) author: Colin MacLeod author: colin.macleod@ivata.com version: $Revision: 1.5 $ |
Method Summary | |
public static Boolean | booleanValue(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.
Parameters: convertToBoolean - a String to be converted to a boolean value. | public static 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.
Parameters: length - the length of the string to generate. | public static String | getNotNull(Object check)
If the string supplied is not null , return the string,
otherwise return the empty string. | public static String | getNotNull(Object check, String nullString)
Handle null objects in a standard way. | public static Integer | integerValue(String convertToInteger)
This method works like Integer.valueOf , but allows
null values without an exception.
Parameters: convertToInteger - a String to be converted to an integer number.null Strings return in a nullInteger returned. | public static boolean | isNullOrEmpty(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.
Parameters: checkString - the string to check for being null or empty. | public static String | toString(Integer convert)
Works like the standard Integer.toString() except that it
allows null values, returning a null string
in this case.
Parameters: convert - the Integer you want to convert to a string. |
booleanValue | public static Boolean booleanValue(String convertToBoolean)(Code) | |
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.
Parameters: convertToBoolean - a String to be converted to a boolean value. null Strings return in a nullBoolean returned. null if convertToBoolean isnull or if convertToBoolean equalsthe string "null" . It returns aBoolean true value if the string is equal to"true" or "on" (ignoring case),otherwise a Booleanfalse value is returned. |
generateRandomString | public static String generateRandomString(int length)(Code) | |
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.
Parameters: length - the length of the string to generate. a random string of the specified length. |
getNotNull | public static String getNotNull(Object check, String nullString)(Code) | |
Handle null objects in a standard way. If the object you pass is null,
then the string nullString will be returned.
Parameters: check - an object to compare against null Parameters: nullString - the string to return if o is null the parameter nullString if o is null, otherwise o.toString() See Also: StringHandling.getNotNull(Object check) |
integerValue | public static Integer integerValue(String convertToInteger)(Code) | |
This method works like Integer.valueOf , but allows
null values without an exception.
Parameters: convertToInteger - a String to be converted to an integer number.null Strings return in a nullInteger returned. null if convertToInteger isnull or if convertToInteger equalsthe string value "null", otherwise an integer representing thebase 10 value of convertToInteger . See Also: java.lang.Integer.valueOf(String convertToInteger) |
isNullOrEmpty | public static boolean isNullOrEmpty(String checkString)(Code) | |
This method does just what it says: evaluates the String you give it and
returns true if it is null or an empty
string.
Parameters: checkString - the string to check for being null or empty. true if checkString isnull or an empty string |
toString | public static String toString(Integer convert)(Code) | |
Works like the standard Integer.toString() except that it
allows null values, returning a null string
in this case.
Parameters: convert - the Integer you want to convert to a string. null if the integer convert . isnull , otherwise the string equivalent ofconvert . |
|
|