org.springframework.validation
Class ValidationUtils
java.lang.Object
org.springframework.validation.ValidationUtils
- public abstract class ValidationUtils
- extends java.lang.Object
This utility class offers convenient methods for invoking a validator and
for rejecting an empty field. Used by BindUtils' bindAndValidate method.
- Since:
- 06.05.2003
- Version:
- $Id: ValidationUtils.java,v 1.5 2004/03/18 02:46:00 trisberg Exp $
- Author:
- Juergen Hoeller, Dmitriy Kopylenko
- See Also:
Validator
,
Errors
,
BindUtils.bindAndValidate(javax.servlet.ServletRequest, java.lang.Object, java.lang.String, org.springframework.validation.Validator)
Method Summary |
static void |
invokeValidator(Validator validator,
java.lang.Object object,
Errors errors)
Invoke the given validator for the given object and Errors instance. |
static void |
rejectIfEmpty(Errors errors,
java.lang.String field,
java.lang.String errorCode,
java.lang.String defaultMessage)
Reject the given field with the given error code and message
if the value is empty. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ValidationUtils
public ValidationUtils()
invokeValidator
public static void invokeValidator(Validator validator,
java.lang.Object object,
Errors errors)
- Invoke the given validator for the given object and Errors instance.
- Parameters:
validator
- validator to be invoked, or null if no validationobject
- object to bind the parameters toerrors
- Errors instance that should store the errors
rejectIfEmpty
public static void rejectIfEmpty(Errors errors,
java.lang.String field,
java.lang.String errorCode,
java.lang.String defaultMessage)
- Reject the given field with the given error code and message
if the value is empty.
- Parameters:
errors
- Errors instance containing bound fieldsfield
- field name to checkerrorCode
- to reject withdefaultMessage
- to reject with
Copyright (C) 2003-2004 The Spring Framework Project.