Here you can find the source of getStringValue(Object str, String def)
public static String getStringValue(Object str, String def)
//package com.java2s; public class Main { public static String getStringValue(Object str, String def) { String s = (String) str; if (null == s || isEmpty(s) || "false".equals(s)) { s = def;//from w ww .j a va 2 s . c o m } return s; } public static boolean isEmpty(String input) { if (input == null || "".equals(input) || "null".equals(input)) return true; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { return false; } } return true; } }