Here you can find the source of emptyToNull(String val)
public static String emptyToNull(String val)
//package com.java2s; /**//from w w w . j a v a2 s. c o m * Copyright (C) 2006 - present David Bulmore * All Rights Reserved. * * This file is part of Easy Java Persistence. * * EJP is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the accompanying license * for more details. * * You should have received a copy of the license along with EJP; if not, * go to http://www.EasierJava.com and download the latest version. */ public class Main { public static String emptyToNull(String val) { return emptyToDefault(val, null); } public static String emptyToDefault(String val, String defaultValue) { if (val == null || val.length() == 0) return defaultValue; return val; } }