org.springframework.web.bind
Class BindUtils
- public abstract class BindUtils
Offers convenience methods for binding servlet request parameters
to objects, including optional validation.
- Author:
- Juergen Hoeller, Jean-Pierre Pawlak
- Since: 10.03.2003
| Method Summary |
static BindException | bind(ServletRequest request, Object object, String objectName) Bind the parameters from the given request to the given object. |
static BindException | bind(ServletRequest request, Object object, String objectName, BindInitializer initializer) Bind the parameters from the given request to the given object,
allowing for optional custom editors set in an bind initializer. |
static BindException | bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator) Bind the parameters from the given request to the given object,
invoking the given validator. |
static BindException | bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator, BindInitializer initializer) Bind the parameters from the given request to the given object,
invoking the given validator, and allowing for optional custom editors
set in an bind initializer. |
bind
public static BindException bind(ServletRequest request, Object object, String objectName)
- Bind the parameters from the given request to the given object.
- Parameters:
- request - request containing the parameters
- object - object to bind the parameters to
- objectName - name of the bind object
- Returns: the binder used (can be treated as BindException or Errors instance)
bind
public static BindException bind(ServletRequest request, Object object, String objectName, BindInitializer initializer)
throws ServletException
- Bind the parameters from the given request to the given object,
allowing for optional custom editors set in an bind initializer.
- Parameters:
- request - request containing the parameters
- object - object to bind the parameters to
- objectName - name of the bind object
- initializer - implementation of the BindInitializer interface
which will be able to set custom editors
- Returns: the binder used (can be treated as BindException or Errors instance)
- Throws:
- ServletException - if thrown by the BindInitializer
bindAndValidate
public static BindException bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator)
- Bind the parameters from the given request to the given object,
invoking the given validator.
- Parameters:
- request - request containing the parameters
- object - object to bind the parameters to
- objectName - name of the bind object
- validator - validator to be invoked, or null if no validation
- Returns: the binder used (can be treated as Errors instance)
bindAndValidate
public static BindException bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator, BindInitializer initializer)
throws ServletException
- Bind the parameters from the given request to the given object,
invoking the given validator, and allowing for optional custom editors
set in an bind initializer.
- Parameters:
- request - request containing the parameters
- object - object to bind the parameters to
- objectName - name of the bind object
- validator - validator to be invoked, or null if no validation
- initializer - Implementation of the BindInitializer interface which will be able to set custom editors
- Returns: the binder used (can be treated as Errors instance)
- Throws:
- ServletException - if thrown by the BindInitializer