Here you can find the source of emptyToNull(String text)
public static String emptyToNull(String text)
//package com.java2s; //License from project: Open Source License public class Main { public static String emptyToNull(String text) { if (text != null) { if (text.trim().isEmpty()) { text = null;//from ww w .java2 s . c o m } } return text; } }