
online.sanen.cdm.template.DataAccessUtils Maven / Gradle / Ivy
package online.sanen.cdm.template;
import java.util.Collection;
import com.mhdt.analyse.Validate;
/**
*
*
* @author online.sanen
* Date:2018年10月14日
* Time:下午6:28:59
*/
public class DataAccessUtils {
public static T requiredSingleResult(Collection results) throws DataAccessException {
if (Validate.isNullOrEmpty(results))
return null;
if (results.size() > 1)
throw new DataAccessException(
"The number of results should be 1, but the actual number is " + results.size());
return results.iterator().next();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy