package cmm.service;

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


@Component("cmmBbsValidator")
public class CmmBbsValidator implements Validator {

	@SuppressWarnings("rawtypes")
	public boolean supports(Class clazz) {
		return clazz.equals(CmmBbsVO.class);
	}
	@SuppressWarnings("unused")
	public void validate(Object obj, Errors errors) {
		CmmBbsVO vo = (CmmBbsVO) obj;
		ValidationUtils.rejectIfEmpty(errors, "nttSj", "field.required", "제목을 입력해주세요."); 
		ValidationUtils.rejectIfEmpty(errors, "nttCn", "field.required", "내용을 입력해주세요."); 
	}
	
}
