一:字段少的校验用法
Assert.notNull(payable, "Payable不能为空!");
Assert.notNull(payable.getNettingStatus(), "Payable.nettingStatus不能为空!");
一:字段多的校验用法(自己写了工具类)
/**
* 校验对象属性
*
* @author dy
* JDK-version: JDK1.7
* @since 2017.5.22
*/
public class ObjectUtils {
private static final Logger logger = LoggerFactory.getLogger(ObjectUtils.class);
/**
* 校验对象属性均不能为空!
*
* @param obj
* @return
* @author DengYang
*/
public static boolean validField(Object obj) throws IllegalAccessException {
if (obj == null)
throw new IllegalAccessException("参数不能为空!");
for (Field field : obj.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (StringUtils.isEmpty(field.g