Here you can find the source of objectToStringNoNull(Object obj)
public static String objectToStringNoNull(Object obj)
//package com.java2s; //License from project: Open Source License public class Main { private static final String NullString = "[NULL]"; /** Converts an object to a string via it's toString() method. If the object itself is null then "[NULL]" is returned. */ public static String objectToStringNoNull(Object obj) { String msg = NullString;//from w ww . ja v a 2s . c o m if (obj != null) msg = obj.toString(); return msg; } }