| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
package com.buckosoft.PicMan.validator; |
| 9 | |
|
| 10 | |
import org.springframework.validation.Errors; |
| 11 | |
import org.springframework.validation.ValidationUtils; |
| 12 | |
import org.springframework.validation.Validator; |
| 13 | |
|
| 14 | |
import com.buckosoft.PicMan.web.DatabaseConverterForm; |
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | 0 | public class DatabaseConverterValidator implements Validator { |
| 21 | |
|
| 22 | |
@SuppressWarnings("rawtypes") |
| 23 | |
public boolean supports(Class clazz) { |
| 24 | 0 | return DatabaseConverterForm.class.isAssignableFrom(clazz); |
| 25 | |
} |
| 26 | |
|
| 27 | |
public void validate(Object obj, Errors errors) { |
| 28 | 0 | ValidationUtils.rejectIfEmpty(errors, "oldName", "OLD_NAME_REQUIRED", "Old name is required."); |
| 29 | 0 | ValidationUtils.rejectIfEmpty(errors, "newName", "NEW_NAME_REQUIRED", "New name is required."); |
| 30 | 0 | } |
| 31 | |
} |