List of utility methods to do Null Value Convert
Boolean | convertNullToFalse(Boolean b) convert Null To False if (b == null) { return Boolean.FALSE; return b; |
int | convertNullToInteger(Object orgStr, int convertStr) : convertNullToInt if (orgStr == null) { return convertStr; } else { return Integer.valueOf(orgStr.toString()); |
Long | convertNullToLong(Object orgStr, Long convertStr) : convertNulg if (orgStr == null || Long.parseLong(orgStr.toString()) == 0) { return convertStr; } else { return Long.valueOf(orgStr.toString()); |
Integer | convertNullToOne(final Object value) Converts value, if null returns one if (value == null) { return 1; if (value instanceof Integer) { return (Integer) value; return Integer.valueOf(value.toString()); |
Object | convertNullToSolrValue(String fieldName) convert Null To Solr Value Object convertedFieldValue = null; if (isSingleValueStringOrText(fieldName)) { convertedFieldValue = null; } else if (fieldName.endsWith("_dt") || fieldName.endsWith("_da")) { convertedFieldValue = null; } else if (fieldName.endsWith("_d")) { convertedFieldValue = null; } else if (isMultiValueStringOrText(fieldName)) { ... |
String | convertNullToString(final String str) convert Null To String if (str == null) { return ""; } else { final int len = str.length(); for (int i = 0; i < len; i++) { if (str.charAt(i) != ' ') break; return str.trim(); |
Object | convertNullValue(final Class> convertType) convert Null Value if ("byte".equals(convertType.getName())) { return (byte) 0; } else if ("short".equals(convertType.getName())) { return (short) 0; } else if ("int".equals(convertType.getName())) { return 0; } else if ("long".equals(convertType.getName())) { return 0L; ... |
String | null2blank(String prnStr) nullblank if (prnStr == null) return ""; else return prnStr; |
String | null2blank(String source) nullblank return source == null ? "" : source; |
boolean | null2Boolean(Object expression, boolean defValue) null Boolean try { return Boolean.parseBoolean(null2String(expression)); } catch (Exception e) { return defValue; |