List of utility methods to do Null Value Convert
boolean | null2Boolean(Object s) null Boolean boolean v = false; if (s != null) try { v = Boolean.parseBoolean(s.toString()); } catch (Exception localException) { return v; |
String | null2default(final String str, final String def) nulldefault return (str == null || str.length() <= 0) ? def : str;
|
String | null2dots(Object s) nulldots if (s == null || s.toString().length() == 0) return "..."; return s.toString(); |
double | null2Double(Object s) null Double double v = 0.0D; if (s != null) try { v = Double.parseDouble(null2String(s)); } catch (Exception localException) { return v; |
double | null2Double(Object s, double defValue) null Double if (s != null) { try { return Double.parseDouble(s.toString()); } catch (Exception e) { return defValue; |
Object | null2Empty(Object obj) null Empty if (obj == null) { return ""; return obj; |
String | null2empty(Object s) nullempty if (s == null) { return ""; if (s instanceof String) { return (String) s; return s.toString(); |
String | null2empty(String str) nullempty return str == null ? "" : str; |
String | null2emptyString(String value) nullempty String if (value != null) { return value; return ""; |
int | null2Int(Object object, int def) null Int if (object != null) { try { return Integer.parseInt(object.toString()); } catch (Exception e) { return def; |