org.springframework.validation
Interface BindingErrorProcessor

All Known Implementing Classes:
DefaultBindingErrorProcessor

public interface BindingErrorProcessor

Strategy for processing DataBinder's missing field errors, and for translating a PropertyAccessException to a FieldError.

The error processor is pluggable so you can treat errors differently if you want to. A default implementation is provided for typical needs.

Since:
1.2
Author:
Alef Arendsen, Juergen Hoeller
See Also:
DataBinder.setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor), DefaultBindingErrorProcessor

Method Summary
 void processMissingFieldError(String missingField, BindException errors)
          Apply the missing field error to the given BindException.
 void processPropertyAccessException(PropertyAccessException ex, BindException errors)
          Translate the given PropertyAccessException to an appropriate error registered on the given Errors instance.
 

Method Detail

processMissingFieldError

void processMissingFieldError(String missingField,
                              BindException errors)
Apply the missing field error to the given BindException.

Usually, a field error is created for a missing required field.

Parameters:
missingField - the field that was missing during binding
errors - the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it.
See Also:
BindException.addError(org.springframework.validation.ObjectError), BindException.resolveMessageCodes(java.lang.String)

processPropertyAccessException

void processPropertyAccessException(PropertyAccessException ex,
                                    BindException errors)
Translate the given PropertyAccessException to an appropriate error registered on the given Errors instance.

Note that two error types are available: FieldError and ObjectError. Usually, field errors are created, but in certain situations one might want to create a global ObjectError instead.

Parameters:
ex - the PropertyAccessException to translate
errors - the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. The BindException object features convenience utils such as a MessageCodesResolver to resolve an error code into message codes.
See Also:
Errors, FieldError, ObjectError, MessageCodesResolver, BindException.addError(org.springframework.validation.ObjectError), BindException.resolveMessageCodes(java.lang.String)


Copyright (c) 2002-2006 The Spring Framework Project.