package com.ssm.model.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.ssm.model.system.SysRole;

public class SysRoleValidator implements Validator{
	@Override
	public boolean supports(Class<?> arg0) {
		return SysRole.class.equals(arg0);
	}

	@Override
	public void validate(Object arg0, Errors errors) {
		ValidationUtils.rejectIfEmpty(errors, "RoleName", null, "角色名不能为空");
		ValidationUtils.rejectIfEmpty(errors, "RoleDesc", null, "角色描述不能为空");
	}
}
