📄 enterhoursvalidator.java
字号:
package com.visualpatterns.timex.controller;
import org.springframework.validation.Errors;
import com.visualpatterns.timex.model.Timesheet;
/**
* Validator for EnterHoursController
* @author anil
* @see com.visualpatterns.timex.controller.EnterHoursController
*/
public class EnterHoursValidator implements
org.springframework.validation.Validator
{
public boolean supports(Class clazz)
{
return clazz.equals(Timesheet.class);
}
/**
* Validates the Timesheet command object. Ensures that the
* departmentCode is specified.
* @see Timesheet
*/
public void validate(Object command, Errors errors)
{
Timesheet timesheet = (Timesheet) command;
if (timesheet == null) return;
if (timesheet.getDepartmentCode() == null
|| timesheet.getDepartmentCode().trim().length() < 1)
errors.reject("error.enterhours.missingdepartment");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -