org.springframework.validation
Class ValidationUtils

java.lang.Object
  extended byorg.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)

Constructor Summary
ValidationUtils()
           
 
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
 

Constructor Detail

ValidationUtils

public ValidationUtils()
Method Detail

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 validation
object - object to bind the parameters to
errors - 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 fields
field - field name to check
errorCode - to reject with
defaultMessage - to reject with


Copyright (C) 2003-2004 The Spring Framework Project.