I want to get string values of my fields (they can be type of long string or any object),
if a field is null then it should return empty string, I did this with guav
If alternative way, Guava provides Strings.nullToEmpty(String).
Strings.nullToEmpty(String)
Source code
String str = null; str = Strings.nullToEmpty(str); System.out.println("String length : " + str.length());
Result
0